Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15283209
D19078.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
D19078.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D19078: Reduce collision rate for concurrency-limiting slot locks
Attached
Detach File
Event Timeline
Log In to Comment