Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13973678
D16739.id40313.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
925 B
Referenced Files
None
Subscribers
None
D16739.id40313.diff
View Options
diff --git a/src/infrastructure/daemon/garbagecollector/PhabricatorGarbageCollector.php b/src/infrastructure/daemon/garbagecollector/PhabricatorGarbageCollector.php
--- a/src/infrastructure/daemon/garbagecollector/PhabricatorGarbageCollector.php
+++ b/src/infrastructure/daemon/garbagecollector/PhabricatorGarbageCollector.php
@@ -98,7 +98,27 @@
}
}
- return $this->collectGarbage();
+ // Hold a lock while performing collection to avoid racing other daemons
+ // running the same collectors.
+ $lock_name = 'gc:'.$this->getCollectorConstant();
+ $lock = PhabricatorGlobalLock::newLock($lock_name);
+
+ try {
+ $lock->lock(5);
+ } catch (PhutilLockException $ex) {
+ return false;
+ }
+
+ try {
+ $result = $this->collectGarbage();
+ } catch (Exception $ex) {
+ $lock->unlock();
+ throw $ex;
+ }
+
+ $lock->unlock();
+
+ return $result;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Oct 19 2024, 2:02 AM (4 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6729762
Default Alt Text
D16739.id40313.diff (925 B)
Attached To
Mode
D16739: Hold a lock while collecting garbage
Attached
Detach File
Event Timeline
Log In to Comment