dont release shared lock if we dont have any
This commit is contained in:
parent
f0b8672729
commit
006eaa84aa
|
@ -88,8 +88,10 @@ class MemcacheLockingProvider implements ILockingProvider {
|
||||||
*/
|
*/
|
||||||
public function releaseLock($path, $type) {
|
public function releaseLock($path, $type) {
|
||||||
if ($type === self::LOCK_SHARED) {
|
if ($type === self::LOCK_SHARED) {
|
||||||
|
if (isset($this->acquiredLocks['shared'][$path]) and $this->acquiredLocks['shared'][$path] > 0) {
|
||||||
$this->memcache->dec($path);
|
$this->memcache->dec($path);
|
||||||
$this->acquiredLocks['shared'][$path]--;
|
$this->acquiredLocks['shared'][$path]--;
|
||||||
|
}
|
||||||
} else if ($type === self::LOCK_EXCLUSIVE) {
|
} else if ($type === self::LOCK_EXCLUSIVE) {
|
||||||
$this->memcache->cas($path, 'exclusive', 0);
|
$this->memcache->cas($path, 'exclusive', 0);
|
||||||
unset($this->acquiredLocks['exclusive'][$path]);
|
unset($this->acquiredLocks['exclusive'][$path]);
|
||||||
|
|
Loading…
Reference in New Issue