Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15414040
D14272.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D14272.diff
View Options
diff --git a/src/applications/drydock/worker/DrydockLeaseUpdateWorker.php b/src/applications/drydock/worker/DrydockLeaseUpdateWorker.php
--- a/src/applications/drydock/worker/DrydockLeaseUpdateWorker.php
+++ b/src/applications/drydock/worker/DrydockLeaseUpdateWorker.php
@@ -211,10 +211,19 @@
$exceptions);
}
+ $resources = $this->removeUnacquirableResources($resources, $lease);
+ if (!$resources) {
+ // If we make it here, we just built a resource but aren't allowed
+ // to acquire it. We expect this during routine operation if the
+ // resource prevents acquisition until it activates. Yield and wait
+ // for activation.
+ throw new PhabricatorWorkerYieldException(15);
+ }
+
// NOTE: We have not acquired the lease yet, so it is possible that the
// resource we just built will be snatched up by some other lease before
- // we can. This is not problematic: we'll retry a little later and should
- // suceed eventually.
+ // we can acquire it. This is not problematic: we'll retry a little later
+ // and should suceed eventually.
}
$resources = $this->rankResources($resources, $lease);
@@ -382,6 +391,22 @@
))
->execute();
+ return $this->removeUnacquirableResources($resources, $lease);
+ }
+
+
+ /**
+ * Remove resources which can not be acquired by a given lease from a list.
+ *
+ * @param list<DrydockResource> Candidate resources.
+ * @param DrydockLease Acquiring lease.
+ * @return list<DrydockResource> Resources which the lease may be able to
+ * acquire.
+ * @task allocator
+ */
+ private function removeUnacquirableResources(
+ array $resources,
+ DrydockLease $lease) {
$keep = array();
foreach ($resources as $key => $resource) {
$blueprint = $resource->getBlueprint();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 20, 10:44 PM (3 d, 17 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7477099
Default Alt Text
D14272.diff (1 KB)
Attached To
Mode
D14272: Fix an issue where newly created Drydock resources could be improperly acquired
Attached
Detach File
Event Timeline
Log In to Comment