Differential D20175 Diff 48189 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_TIMESTAMPS => false, | ||||
self::CONFIG_KEY_SCHEMA => array( | self::CONFIG_KEY_SCHEMA => array( | ||||
'dataID' => array( | |||||
'columns' => array('dataID'), | |||||
'unique' => true, | |||||
), | |||||
'taskClass' => array( | 'taskClass' => array( | ||||
'columns' => array('taskClass'), | 'columns' => array('taskClass'), | ||||
), | ), | ||||
'leaseExpires' => array( | 'leaseExpires' => array( | ||||
'columns' => array('leaseExpires'), | 'columns' => array('leaseExpires'), | ||||
), | ), | ||||
'leaseOwner' => array( | |||||
'columns' => array('leaseOwner(16)'), | |||||
), | |||||
'key_failuretime' => array( | 'key_failuretime' => array( | ||||
'columns' => array('failureTime'), | 'columns' => array('failureTime'), | ||||
), | ), | ||||
'leaseOwner_2' => array( | 'key_owner' => array( | ||||
'columns' => array('leaseOwner', 'priority', 'id'), | 'columns' => array('leaseOwner', 'priority', 'id'), | ||||
), | ), | ||||
) + $parent[self::CONFIG_KEY_SCHEMA], | ) + $parent[self::CONFIG_KEY_SCHEMA], | ||||
); | ); | ||||
$config[self::CONFIG_COLUMN_SCHEMA] = array( | |||||
// T6203/NULLABILITY | |||||
// This isn't nullable in the archive table, so at a minimum these | |||||
// should be the same. | |||||
'dataID' => 'uint32?', | |||||
) + $parent[self::CONFIG_COLUMN_SCHEMA]; | |||||
return $config + $parent; | return $config + $parent; | ||||
} | } | ||||
public function setServerTime($server_time) { | public function setServerTime($server_time) { | ||||
$this->serverTime = $server_time; | $this->serverTime = $server_time; | ||||
$this->localTime = time(); | $this->localTime = time(); | ||||
return $this; | return $this; | ||||
} | } | ||||
Show All 15 Lines | final class PhabricatorWorkerActiveTask extends PhabricatorWorkerTask { | ||||
} | } | ||||
public function forceSaveWithoutLease() { | public function forceSaveWithoutLease() { | ||||
$is_new = !$this->getID(); | $is_new = !$this->getID(); | ||||
if ($is_new) { | if ($is_new) { | ||||
$this->failureCount = 0; | $this->failureCount = 0; | ||||
} | } | ||||
if ($is_new && ($this->getData() !== null)) { | if ($is_new) { | ||||
$data = new PhabricatorWorkerTaskData(); | $data = new PhabricatorWorkerTaskData(); | ||||
$data->setData($this->getData()); | $data->setData($this->getData()); | ||||
$data->save(); | $data->save(); | ||||
$this->setDataID($data->getID()); | $this->setDataID($data->getID()); | ||||
} | } | ||||
return parent::save(); | return parent::save(); | ||||
▲ Show 20 Lines • Show All 143 Lines • Show Last 20 Lines |