mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 06:20:56 +01:00
Show lease on Repository Operation detail view and awaken on failures
Summary: Ref T182. Couple of minor improvements here: - Show the Drydock lease when viewing a Repository Operation detail screen. This just makes it easier to jump around between relevant objects. - When tasks are waiting for a lease, awaken them when it breaks or is released, not just when it is acquired. This makes the queue move forward faster when errors occur. Test Plan: - Viewed a repository operation and saw a link to the lease. - Did a bad land (intentional merge problem) and got an error in about ~3 seconds instead of ~17. Reviewers: chad Reviewed By: chad Maniphest Tasks: T182 Differential Revision: https://secure.phabricator.com/D14341
This commit is contained in:
parent
a0fba642b3
commit
2326d5f8d0
5 changed files with 44 additions and 12 deletions
|
@ -83,6 +83,15 @@ final class DrydockRepositoryOperationViewController
|
|||
pht('Object'),
|
||||
$viewer->renderHandle($operation->getObjectPHID()));
|
||||
|
||||
$lease_phid = $operation->getWorkingCopyLeasePHID();
|
||||
if ($lease_phid) {
|
||||
$lease_display = $viewer->renderHandle($lease_phid);
|
||||
} else {
|
||||
$lease_display = phutil_tag('em', array(), pht('None'));
|
||||
}
|
||||
|
||||
$view->addProperty(pht('Working Copy'), $lease_display);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
|
|
|
@ -429,10 +429,7 @@ final class DrydockLease extends DrydockDAO
|
|||
$this->scheduleUpdate($expires);
|
||||
}
|
||||
|
||||
$awaken_ids = $this->getAttribute('internal.awakenTaskIDs');
|
||||
if (is_array($awaken_ids) && $awaken_ids) {
|
||||
PhabricatorWorker::awakenTaskIDs($awaken_ids);
|
||||
}
|
||||
$this->awakenTasks();
|
||||
}
|
||||
|
||||
public function logEvent($type, array $data = array()) {
|
||||
|
@ -454,6 +451,19 @@ final class DrydockLease extends DrydockDAO
|
|||
return $log->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Awaken yielded tasks after a state change.
|
||||
*
|
||||
* @return this
|
||||
*/
|
||||
public function awakenTasks() {
|
||||
$awaken_ids = $this->getAttribute('internal.awakenTaskIDs');
|
||||
if (is_array($awaken_ids) && $awaken_ids) {
|
||||
PhabricatorWorker::awakenTaskIDs($awaken_ids);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
||||
|
|
|
@ -167,6 +167,15 @@ final class DrydockRepositoryOperation extends DrydockDAO
|
|||
$this);
|
||||
}
|
||||
|
||||
public function setWorkingCopyLeasePHID($lease_phid) {
|
||||
return $this->setProperty('exec.leasePHID', $lease_phid);
|
||||
}
|
||||
|
||||
public function getWorkingCopyLeasePHID() {
|
||||
return $this->getProperty('exec.leasePHID');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
||||
|
||||
|
|
|
@ -751,6 +751,15 @@ final class DrydockLeaseUpdateWorker extends DrydockWorker {
|
|||
->setStatus(DrydockLeaseStatus::STATUS_BROKEN)
|
||||
->save();
|
||||
|
||||
$lease->logEvent(
|
||||
DrydockLeaseActivationFailureLogType::LOGCONST,
|
||||
array(
|
||||
'class' => get_class($ex),
|
||||
'message' => $ex->getMessage(),
|
||||
));
|
||||
|
||||
$lease->awakenTasks();
|
||||
|
||||
$this->queueTask(
|
||||
__CLASS__,
|
||||
array(
|
||||
|
@ -760,13 +769,6 @@ final class DrydockLeaseUpdateWorker extends DrydockWorker {
|
|||
'objectPHID' => $lease->getPHID(),
|
||||
));
|
||||
|
||||
$lease->logEvent(
|
||||
DrydockLeaseActivationFailureLogType::LOGCONST,
|
||||
array(
|
||||
'class' => get_class($ex),
|
||||
'message' => $ex->getMessage(),
|
||||
));
|
||||
|
||||
throw new PhabricatorWorkerPermanentFailureException(
|
||||
pht(
|
||||
'Permanent failure while activating lease ("%s"): %s',
|
||||
|
@ -796,6 +798,8 @@ final class DrydockLeaseUpdateWorker extends DrydockWorker {
|
|||
->save();
|
||||
|
||||
$lease->logEvent(DrydockLeaseDestroyedLogType::LOGCONST);
|
||||
|
||||
$lease->awakenTasks();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ final class DrydockRepositoryOperationUpdateWorker
|
|||
}
|
||||
|
||||
$operation
|
||||
->setProperty('exec.leasePHID', $lease->getPHID())
|
||||
->setWorkingCopyLeasePHID($lease->getPHID())
|
||||
->save();
|
||||
|
||||
$lease->queueForActivation();
|
||||
|
|
Loading…
Reference in a new issue