Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/worker/HarbormasterTargetWorker.php
| Show All 40 Lines | private function loadBuildTarget() { | ||||
| return $target; | return $target; | ||||
| } | } | ||||
| protected function doWork() { | protected function doWork() { | ||||
| $target = $this->loadBuildTarget(); | $target = $this->loadBuildTarget(); | ||||
| $build = $target->getBuild(); | $build = $target->getBuild(); | ||||
| $viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
| $target->setDateStarted(time()); | // If this is the first time we're starting work on this target, mark the | ||||
| // current time as the start time. If the target yields or waits, we may | |||||
| // end up here again later, so we don't want to overwrite the start time if | |||||
| // we already have a value. | |||||
| if (!$target->getDateStarted()) { | |||||
| $target->setDateStarted(PhabricatorTime::getNow()); | |||||
| } | |||||
| try { | try { | ||||
| if ($target->getBuildGeneration() !== $build->getBuildGeneration()) { | if ($target->getBuildGeneration() !== $build->getBuildGeneration()) { | ||||
| throw new HarbormasterBuildAbortedException(); | throw new HarbormasterBuildAbortedException(); | ||||
| } | } | ||||
| $status_pending = HarbormasterBuildTarget::STATUS_PENDING; | $status_pending = HarbormasterBuildTarget::STATUS_PENDING; | ||||
| if ($target->getTargetStatus() == $status_pending) { | if ($target->getTargetStatus() == $status_pending) { | ||||
| ▲ Show 20 Lines • Show All 55 Lines • Show Last 20 Lines | |||||