@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

epriestley and committed by
epriestley
2326d5f8 a0fba642

+44 -12
+9
src/applications/drydock/controller/DrydockRepositoryOperationViewController.php
··· 83 83 pht('Object'), 84 84 $viewer->renderHandle($operation->getObjectPHID())); 85 85 86 + $lease_phid = $operation->getWorkingCopyLeasePHID(); 87 + if ($lease_phid) { 88 + $lease_display = $viewer->renderHandle($lease_phid); 89 + } else { 90 + $lease_display = phutil_tag('em', array(), pht('None')); 91 + } 92 + 93 + $view->addProperty(pht('Working Copy'), $lease_display); 94 + 86 95 return $view; 87 96 } 88 97
+14 -4
src/applications/drydock/storage/DrydockLease.php
··· 429 429 $this->scheduleUpdate($expires); 430 430 } 431 431 432 - $awaken_ids = $this->getAttribute('internal.awakenTaskIDs'); 433 - if (is_array($awaken_ids) && $awaken_ids) { 434 - PhabricatorWorker::awakenTaskIDs($awaken_ids); 435 - } 432 + $this->awakenTasks(); 436 433 } 437 434 438 435 public function logEvent($type, array $data = array()) { ··· 454 451 return $log->save(); 455 452 } 456 453 454 + /** 455 + * Awaken yielded tasks after a state change. 456 + * 457 + * @return this 458 + */ 459 + public function awakenTasks() { 460 + $awaken_ids = $this->getAttribute('internal.awakenTaskIDs'); 461 + if (is_array($awaken_ids) && $awaken_ids) { 462 + PhabricatorWorker::awakenTaskIDs($awaken_ids); 463 + } 464 + 465 + return $this; 466 + } 457 467 458 468 459 469 /* -( PhabricatorPolicyInterface )----------------------------------------- */
+9
src/applications/drydock/storage/DrydockRepositoryOperation.php
··· 167 167 $this); 168 168 } 169 169 170 + public function setWorkingCopyLeasePHID($lease_phid) { 171 + return $this->setProperty('exec.leasePHID', $lease_phid); 172 + } 173 + 174 + public function getWorkingCopyLeasePHID() { 175 + return $this->getProperty('exec.leasePHID'); 176 + } 177 + 178 + 170 179 171 180 /* -( PhabricatorPolicyInterface )----------------------------------------- */ 172 181
+11 -7
src/applications/drydock/worker/DrydockLeaseUpdateWorker.php
··· 751 751 ->setStatus(DrydockLeaseStatus::STATUS_BROKEN) 752 752 ->save(); 753 753 754 + $lease->logEvent( 755 + DrydockLeaseActivationFailureLogType::LOGCONST, 756 + array( 757 + 'class' => get_class($ex), 758 + 'message' => $ex->getMessage(), 759 + )); 760 + 761 + $lease->awakenTasks(); 762 + 754 763 $this->queueTask( 755 764 __CLASS__, 756 765 array( ··· 758 767 ), 759 768 array( 760 769 'objectPHID' => $lease->getPHID(), 761 - )); 762 - 763 - $lease->logEvent( 764 - DrydockLeaseActivationFailureLogType::LOGCONST, 765 - array( 766 - 'class' => get_class($ex), 767 - 'message' => $ex->getMessage(), 768 770 )); 769 771 770 772 throw new PhabricatorWorkerPermanentFailureException( ··· 796 798 ->save(); 797 799 798 800 $lease->logEvent(DrydockLeaseDestroyedLogType::LOGCONST); 801 + 802 + $lease->awakenTasks(); 799 803 } 800 804 801 805 }
+1 -1
src/applications/drydock/worker/DrydockRepositoryOperationUpdateWorker.php
··· 127 127 } 128 128 129 129 $operation 130 - ->setProperty('exec.leasePHID', $lease->getPHID()) 130 + ->setWorkingCopyLeasePHID($lease->getPHID()) 131 131 ->save(); 132 132 133 133 $lease->queueForActivation();