Differential D9871 Diff 23765 src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php
Show First 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | public function archiveTask($result, $duration) { | ||||
$archive = id(new PhabricatorWorkerArchiveTask()) | $archive = id(new PhabricatorWorkerArchiveTask()) | ||||
->setID($this->getID()) | ->setID($this->getID()) | ||||
->setTaskClass($this->getTaskClass()) | ->setTaskClass($this->getTaskClass()) | ||||
->setLeaseOwner($this->getLeaseOwner()) | ->setLeaseOwner($this->getLeaseOwner()) | ||||
->setLeaseExpires($this->getLeaseExpires()) | ->setLeaseExpires($this->getLeaseExpires()) | ||||
->setFailureCount($this->getFailureCount()) | ->setFailureCount($this->getFailureCount()) | ||||
->setDataID($this->getDataID()) | ->setDataID($this->getDataID()) | ||||
->setPriority($this->getPriority()) | |||||
->setResult($result) | ->setResult($result) | ||||
->setDuration($duration); | ->setDuration($duration); | ||||
// NOTE: This deletes the active task (this object)! | // NOTE: This deletes the active task (this object)! | ||||
$archive->save(); | $archive->save(); | ||||
return $archive; | return $archive; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | try { | ||||
$result = $this; | $result = $this; | ||||
} | } | ||||
// NOTE: If this throws, we don't want it to cause the task to fail again, | // NOTE: If this throws, we don't want it to cause the task to fail again, | ||||
// so execute it out here and just let the exception escape. | // so execute it out here and just let the exception escape. | ||||
if ($did_succeed) { | if ($did_succeed) { | ||||
foreach ($worker->getQueuedTasks() as $task) { | foreach ($worker->getQueuedTasks() as $task) { | ||||
list($class, $data) = $task; | list($class, $data) = $task; | ||||
PhabricatorWorker::scheduleTask($class, $data); | PhabricatorWorker::scheduleTask($class, $data, $this->getPriority()); | ||||
} | } | ||||
} | } | ||||
return $result; | return $result; | ||||
} | } | ||||
} | } |