Differential D19174 Diff 45930 src/infrastructure/daemon/garbagecollector/PhabricatorGarbageCollector.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/daemon/garbagecollector/PhabricatorGarbageCollector.php
| Show First 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | if (!$this->hasAutomaticPolicy()) { | ||||
| $policy = $this->getRetentionPolicy(); | $policy = $this->getRetentionPolicy(); | ||||
| if (!$policy) { | if (!$policy) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| } | } | ||||
| // Hold a lock while performing collection to avoid racing other daemons | // Hold a lock while performing collection to avoid racing other daemons | ||||
| // running the same collectors. | // running the same collectors. | ||||
| $lock_name = 'gc:'.$this->getCollectorConstant(); | $params = array( | ||||
| $lock = PhabricatorGlobalLock::newLock($lock_name); | 'collector' => $this->getCollectorConstant(), | ||||
| ); | |||||
| $lock = PhabricatorGlobalLock::newLock('gc', $params); | |||||
| try { | try { | ||||
| $lock->lock(5); | $lock->lock(5); | ||||
| } catch (PhutilLockException $ex) { | } catch (PhutilLockException $ex) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| try { | try { | ||||
| ▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines | |||||