Changeset View
Changeset View
Standalone View
Standalone View
src/applications/drydock/storage/DrydockSlotLock.php
Show First 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | foreach ($locks as $lock) { | ||||
$owner_phid, | $owner_phid, | ||||
PhabricatorHash::digestForIndex($lock), | PhabricatorHash::digestForIndex($lock), | ||||
$lock); | $lock); | ||||
} | } | ||||
try { | try { | ||||
queryfx( | queryfx( | ||||
$conn_w, | $conn_w, | ||||
'INSERT INTO %T (ownerPHID, lockIndex, lockKey) VALUES %Q', | 'INSERT INTO %T (ownerPHID, lockIndex, lockKey) VALUES %LQ', | ||||
$table->getTableName(), | $table->getTableName(), | ||||
implode(', ', $sql)); | $sql); | ||||
} catch (AphrontDuplicateKeyQueryException $ex) { | } catch (AphrontDuplicateKeyQueryException $ex) { | ||||
// Try to improve the readability of the exception. We might miss on | // Try to improve the readability of the exception. We might miss on | ||||
// this query if the lock has already been released, but most of the | // this query if the lock has already been released, but most of the | ||||
// time we should be able to figure out which locks are already held. | // time we should be able to figure out which locks are already held. | ||||
$held = self::loadHeldLocks($locks); | $held = self::loadHeldLocks($locks); | ||||
$held = mpull($held, 'getOwnerPHID', 'getLockKey'); | $held = mpull($held, 'getOwnerPHID', 'getLockKey'); | ||||
throw new DrydockSlotLockException($held); | throw new DrydockSlotLockException($held); | ||||
Show All 23 Lines |