Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/daemon/workers/PhabricatorWorker.php
| Show First 20 Lines • Show All 128 Lines • ▼ Show 20 Lines | final public static function scheduleTask( | ||||
| $data, | $data, | ||||
| $options = array()) { | $options = array()) { | ||||
| PhutilTypeSpec::checkMap( | PhutilTypeSpec::checkMap( | ||||
| $options, | $options, | ||||
| array( | array( | ||||
| 'priority' => 'optional int|null', | 'priority' => 'optional int|null', | ||||
| 'objectPHID' => 'optional string|null', | 'objectPHID' => 'optional string|null', | ||||
| 'containerPHID' => 'optional string|null', | |||||
| 'delayUntil' => 'optional int|null', | 'delayUntil' => 'optional int|null', | ||||
| )); | )); | ||||
| $priority = idx($options, 'priority'); | $priority = idx($options, 'priority'); | ||||
| if ($priority === null) { | if ($priority === null) { | ||||
| $priority = self::PRIORITY_DEFAULT; | $priority = self::PRIORITY_DEFAULT; | ||||
| } | } | ||||
| $object_phid = idx($options, 'objectPHID'); | $object_phid = idx($options, 'objectPHID'); | ||||
| $container_phid = idx($options, 'containerPHID'); | |||||
| $task = id(new PhabricatorWorkerActiveTask()) | $task = id(new PhabricatorWorkerActiveTask()) | ||||
| ->setTaskClass($task_class) | ->setTaskClass($task_class) | ||||
| ->setData($data) | ->setData($data) | ||||
| ->setPriority($priority) | ->setPriority($priority) | ||||
| ->setObjectPHID($object_phid); | ->setObjectPHID($object_phid) | ||||
| ->setContainerPHID($container_phid); | |||||
| $delay = idx($options, 'delayUntil'); | $delay = idx($options, 'delayUntil'); | ||||
| if ($delay) { | if ($delay) { | ||||
| $task->setLeaseExpires($delay); | $task->setLeaseExpires($delay); | ||||
| } | } | ||||
| if (self::$runAllTasksInProcess) { | if (self::$runAllTasksInProcess) { | ||||
| // Do the work in-process. | // Do the work in-process. | ||||
| ▲ Show 20 Lines • Show All 168 Lines • Show Last 20 Lines | |||||