Skip to content
This repository was archived by the owner on Apr 7, 2022. It is now read-only.

Commit 4ac82be

Browse files
author
epriestley
committed
Merge the DrydockLease workers into a single worker
Summary: Ref T9252. This is the same as D14201, but for lease stuff instead of resource stuff. This one is a little heavier but still feels pretty reasonable to me at the end of the day (worker is <1K lines and has a ton of comment stuff). Also fixes a few random bugs I hit in the task queue. Test Plan: - Restarted some Harbormaster builds, saw them go through cleanly. - Released pre-activation resources/leases. - Probably still kinda buggy but I'll iron the details out over time. Logs are starting to look somewhat plausible: {F855747} Reviewers: chad Reviewed By: chad Maniphest Tasks: T9252 Differential Revision: https://secure.phabricator.com/D14202
1 parent 91e5ca0 commit 4ac82be

File tree

9 files changed

+615
-628
lines changed

9 files changed

+615
-628
lines changed

src/__phutil_library_map__.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,6 @@
796796
'DoorkeeperSchemaSpec' => 'applications/doorkeeper/storage/DoorkeeperSchemaSpec.php',
797797
'DoorkeeperTagView' => 'applications/doorkeeper/view/DoorkeeperTagView.php',
798798
'DoorkeeperTagsController' => 'applications/doorkeeper/controller/DoorkeeperTagsController.php',
799-
'DrydockAllocatorWorker' => 'applications/drydock/worker/DrydockAllocatorWorker.php',
800799
'DrydockAlmanacServiceHostBlueprintImplementation' => 'applications/drydock/blueprint/DrydockAlmanacServiceHostBlueprintImplementation.php',
801800
'DrydockApacheWebrootInterface' => 'applications/drydock/interface/webroot/DrydockApacheWebrootInterface.php',
802801
'DrydockBlueprint' => 'applications/drydock/storage/DrydockBlueprint.php',
@@ -834,7 +833,6 @@
834833
'DrydockLeaseActivatedLogType' => 'applications/drydock/logtype/DrydockLeaseActivatedLogType.php',
835834
'DrydockLeaseController' => 'applications/drydock/controller/DrydockLeaseController.php',
836835
'DrydockLeaseDatasource' => 'applications/drydock/typeahead/DrydockLeaseDatasource.php',
837-
'DrydockLeaseDestroyWorker' => 'applications/drydock/worker/DrydockLeaseDestroyWorker.php',
838836
'DrydockLeaseDestroyedLogType' => 'applications/drydock/logtype/DrydockLeaseDestroyedLogType.php',
839837
'DrydockLeaseListController' => 'applications/drydock/controller/DrydockLeaseListController.php',
840838
'DrydockLeaseListView' => 'applications/drydock/view/DrydockLeaseListView.php',
@@ -847,7 +845,6 @@
847845
'DrydockLeaseStatus' => 'applications/drydock/constants/DrydockLeaseStatus.php',
848846
'DrydockLeaseUpdateWorker' => 'applications/drydock/worker/DrydockLeaseUpdateWorker.php',
849847
'DrydockLeaseViewController' => 'applications/drydock/controller/DrydockLeaseViewController.php',
850-
'DrydockLeaseWorker' => 'applications/drydock/worker/DrydockLeaseWorker.php',
851848
'DrydockLog' => 'applications/drydock/storage/DrydockLog.php',
852849
'DrydockLogController' => 'applications/drydock/controller/DrydockLogController.php',
853850
'DrydockLogGarbageCollector' => 'applications/drydock/garbagecollector/DrydockLogGarbageCollector.php',
@@ -4525,7 +4522,6 @@
45254522
'DoorkeeperSchemaSpec' => 'PhabricatorConfigSchemaSpec',
45264523
'DoorkeeperTagView' => 'AphrontView',
45274524
'DoorkeeperTagsController' => 'PhabricatorController',
4528-
'DrydockAllocatorWorker' => 'DrydockWorker',
45294525
'DrydockAlmanacServiceHostBlueprintImplementation' => 'DrydockBlueprintImplementation',
45304526
'DrydockApacheWebrootInterface' => 'DrydockWebrootInterface',
45314527
'DrydockBlueprint' => array(
@@ -4577,7 +4573,6 @@
45774573
'DrydockLeaseActivatedLogType' => 'DrydockLogType',
45784574
'DrydockLeaseController' => 'DrydockController',
45794575
'DrydockLeaseDatasource' => 'PhabricatorTypeaheadDatasource',
4580-
'DrydockLeaseDestroyWorker' => 'DrydockWorker',
45814576
'DrydockLeaseDestroyedLogType' => 'DrydockLogType',
45824577
'DrydockLeaseListController' => 'DrydockLeaseController',
45834578
'DrydockLeaseListView' => 'AphrontView',
@@ -4590,7 +4585,6 @@
45904585
'DrydockLeaseStatus' => 'DrydockConstants',
45914586
'DrydockLeaseUpdateWorker' => 'DrydockWorker',
45924587
'DrydockLeaseViewController' => 'DrydockLeaseController',
4593-
'DrydockLeaseWorker' => 'DrydockWorker',
45944588
'DrydockLog' => array(
45954589
'DrydockDAO',
45964590
'PhabricatorPolicyInterface',

src/applications/drydock/storage/DrydockLease.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,7 @@ public function queueForActivation() {
135135
->setStatus(DrydockLeaseStatus::STATUS_PENDING)
136136
->save();
137137

138-
$task = PhabricatorWorker::scheduleTask(
139-
'DrydockAllocatorWorker',
140-
array(
141-
'leasePHID' => $this->getPHID(),
142-
),
143-
array(
144-
'objectPHID' => $this->getPHID(),
145-
));
138+
$this->scheduleUpdate();
146139

147140
$this->logEvent(DrydockLeaseQueuedLogType::LOGCONST);
148141

@@ -321,12 +314,13 @@ public function canRelease() {
321314
}
322315
}
323316

324-
public function canUpdate() {
317+
public function canReceiveCommands() {
325318
switch ($this->getStatus()) {
326-
case DrydockLeaseStatus::STATUS_ACTIVE:
327-
return true;
328-
default:
319+
case DrydockLeaseStatus::STATUS_RELEASED:
320+
case DrydockLeaseStatus::STATUS_DESTROYED:
329321
return false;
322+
default:
323+
return true;
330324
}
331325
}
332326

0 commit comments

Comments
 (0)