1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42: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:
epriestley 2012-07-09 10:39:30 -07:00
parent d86c4e0366
commit bf8cbf55b1

View file

@ -35,6 +35,10 @@
* do_contentious_things();
* $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 impl Implementation
*/
@ -48,7 +52,8 @@ final class PhabricatorGlobalLock extends PhutilLock {
public static function newLock($name) {
$full_name = 'global:'.$name;
$namespace = PhabricatorLiskDAO::getStorageNamespace();
$full_name = 'global:'.$namespace.':'.$name;
$lock = self::getLock($full_name);
if (!$lock) {