Differential D20200 Diff 48235 src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php
<?php | <?php | ||||
final class PhabricatorWorkerActiveTask extends PhabricatorWorkerTask { | final class PhabricatorWorkerActiveTask extends PhabricatorWorkerTask { | ||||
protected $failureTime; | protected $failureTime; | ||||
private $serverTime; | private $serverTime; | ||||
private $localTime; | private $localTime; | ||||
protected function getConfiguration() { | protected function getConfiguration() { | ||||
$parent = parent::getConfiguration(); | $parent = parent::getConfiguration(); | ||||
$config = array( | $config = array( | ||||
self::CONFIG_IDS => self::IDS_COUNTER, | self::CONFIG_IDS => self::IDS_COUNTER, | ||||
self::CONFIG_TIMESTAMPS => false, | |||||
self::CONFIG_KEY_SCHEMA => array( | self::CONFIG_KEY_SCHEMA => array( | ||||
'taskClass' => array( | 'taskClass' => array( | ||||
'columns' => array('taskClass'), | 'columns' => array('taskClass'), | ||||
), | ), | ||||
'leaseExpires' => array( | 'leaseExpires' => array( | ||||
'columns' => array('leaseExpires'), | 'columns' => array('leaseExpires'), | ||||
), | ), | ||||
'key_failuretime' => array( | 'key_failuretime' => array( | ||||
▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | $archive = id(new PhabricatorWorkerArchiveTask()) | ||||
->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()) | ->setPriority($this->getPriority()) | ||||
->setObjectPHID($this->getObjectPHID()) | ->setObjectPHID($this->getObjectPHID()) | ||||
->setResult($result) | ->setResult($result) | ||||
->setDuration($duration); | ->setDuration($duration) | ||||
->setDateCreated($this->getDateCreated()) | |||||
->setArchivedEpoch(PhabricatorTime::getNow()); | |||||
epriestley: `PhabricatorWorkerArchiveTask->unarchiveTask()` might need a similar change (copy over… | |||||
Done Inline ActionsThis doesn't quite work. dateCreated can be copied over fine, but Lisk is (I assume) detecting that the object is dirty and overriding my dateModified to be the current time. amckinley: This doesn't quite work. `dateCreated` can be copied over fine, but Lisk is (I assume)… | |||||
Done Inline ActionsYeah, it's willSaveObject on LiskDAO. I could implement willSaveObject on WorkerActiveTask and just do the right thing, unless you have another idea. amckinley: Yeah, it's `willSaveObject` on `LiskDAO`. I could implement `willSaveObject` on… | |||||
Done Inline ActionsIf the other setDateModified() didn't work, this one probably has no effect either? epriestley: If the other `setDateModified()` didn't work, this one probably has no effect either? | |||||
Done Inline ActionsOh yeah, it'll be overwritten the same way. amckinley: Oh yeah, it'll be overwritten the same way. | |||||
// NOTE: This deletes the active task (this object)! | // NOTE: This deletes the active task (this object)! | ||||
$archive->save(); | $archive->save(); | ||||
return $archive; | return $archive; | ||||
} | } | ||||
public function executeTask() { | public function executeTask() { | ||||
▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines |
PhabricatorWorkerArchiveTask->unarchiveTask() might need a similar change (copy over datecreated / datemodified, but just drop archivedEpoch since it's no longer archived).
This is currently only testable by bin/worker retry-ing a permanently failed task, but I want to change bin/worker retry to let you retry successful tasks too, just with a warning ("This task already succeeded, so retrying it might do whatever it does twice, are you sure you can handle that?")