mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 09:12:41 +01:00
Namespace GlobalLocks to storage namespaces
Summary: Currently, multiple unit tests that acquire global locks will interfere with each other. Namespace the locks so they don't. (Possibly we should also rename this to PhabricatorStorageNamespaceLock or something since it's not really global any more, but that's kind of unwieldy...) Test Plan: Acquired locks with --trace and verified they were namespaced properly. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T1162 Differential Revision: https://secure.phabricator.com/D2939
This commit is contained in:
parent
d86c4e0366
commit
bf8cbf55b1
1 changed files with 6 additions and 1 deletions
|
@ -35,6 +35,10 @@
|
||||||
* do_contentious_things();
|
* do_contentious_things();
|
||||||
* $lock->unlock();
|
* $lock->unlock();
|
||||||
*
|
*
|
||||||
|
* NOTE: This lock is not completely global; it is namespaced to the active
|
||||||
|
* storage namespace so that unit tests running in separate table namespaces
|
||||||
|
* are isolated from one another.
|
||||||
|
*
|
||||||
* @task construct Constructing Locks
|
* @task construct Constructing Locks
|
||||||
* @task impl Implementation
|
* @task impl Implementation
|
||||||
*/
|
*/
|
||||||
|
@ -48,7 +52,8 @@ final class PhabricatorGlobalLock extends PhutilLock {
|
||||||
|
|
||||||
|
|
||||||
public static function newLock($name) {
|
public static function newLock($name) {
|
||||||
$full_name = 'global:'.$name;
|
$namespace = PhabricatorLiskDAO::getStorageNamespace();
|
||||||
|
$full_name = 'global:'.$namespace.':'.$name;
|
||||||
|
|
||||||
$lock = self::getLock($full_name);
|
$lock = self::getLock($full_name);
|
||||||
if (!$lock) {
|
if (!$lock) {
|
||||||
|
|
Loading…
Reference in a new issue