mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 05:50:55 +01:00
Parameterize the repository read and write locks
Summary: Ref T13202. See PHI889. Update the read and write locks to the modern parameterized verison, which handles hashing/normalization and can store better logs. This parameterized mode was added in D19173 and has been used successfully for some time, but not all locks have switched over to it yet. Test Plan: - Added an `fprintf(STDERR, $full_name)` to the lock code. - Pulled a repository. - Saw sensible lock name on stdout before "acquired read lock...". - Additional changes in this patch series will vet this more completely. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13202 Differential Revision: https://secure.phabricator.com/D19701
This commit is contained in:
parent
3244324cb1
commit
7db265cd5d
1 changed files with 9 additions and 7 deletions
|
@ -76,18 +76,20 @@ final class PhabricatorRepositoryWorkingCopyVersion
|
|||
|
||||
|
||||
public static function getReadLock($repository_phid, $device_phid) {
|
||||
$repository_hash = PhabricatorHash::digestForIndex($repository_phid);
|
||||
$device_hash = PhabricatorHash::digestForIndex($device_phid);
|
||||
$lock_key = "repo.read({$repository_hash}, {$device_hash})";
|
||||
$parameters = array(
|
||||
'repositoryPHID' => $repository_phid,
|
||||
'devicePHID' => $device_phid,
|
||||
);
|
||||
|
||||
return PhabricatorGlobalLock::newLock($lock_key);
|
||||
return PhabricatorGlobalLock::newLock('repo.read', $parameters);
|
||||
}
|
||||
|
||||
public static function getWriteLock($repository_phid) {
|
||||
$repository_hash = PhabricatorHash::digestForIndex($repository_phid);
|
||||
$lock_key = "repo.write({$repository_hash})";
|
||||
$parameters = array(
|
||||
'repositoryPHID' => $repository_phid,
|
||||
);
|
||||
|
||||
return PhabricatorGlobalLock::newLock($lock_key);
|
||||
return PhabricatorGlobalLock::newLock('repo.write', $parameters);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue