Page MenuHomePhabricator

D19078.diff
No OneTemporary

D19078.diff

diff --git a/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php b/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php
--- a/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php
+++ b/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php
@@ -396,16 +396,20 @@
}
// For reasonable limits, actually check for an available slot.
- $locks = DrydockSlotLock::loadLocks($blueprint_phid);
- $locks = mpull($locks, null, 'getLockKey');
-
$slots = range(0, $limit - 1);
shuffle($slots);
+ $lock_names = array();
foreach ($slots as $slot) {
- $slot_lock = "allocator({$blueprint_phid}).limit({$slot})";
- if (empty($locks[$slot_lock])) {
- return $slot_lock;
+ $lock_names[] = "allocator({$blueprint_phid}).limit({$slot})";
+ }
+
+ $locks = DrydockSlotLock::loadHeldLocks($lock_names);
+ $locks = mpull($locks, null, 'getLockKey');
+
+ foreach ($lock_names as $lock_name) {
+ if (empty($locks[$lock_name])) {
+ return $lock_name;
}
}
@@ -414,7 +418,8 @@
// lock will be free by the time we try to take it, but usually we'll just
// fail to grab the lock, throw an appropriate lock exception, and get back
// on the right path to retry later.
- return $slot_lock;
+
+ return $lock_name;
}

File Metadata

Mime Type
text/plain
Expires
Wed, Mar 5, 6:07 AM (4 d, 20 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7223715
Default Alt Text
D19078.diff (1 KB)

Event Timeline