add locks in the scanner to prevent multiple scanners running on the same files

remotes/origin/ldap-integration-tests-1up
Robin Appelman 9 years ago committed by Roeland Jago Douma
parent 74de72e75e
commit 4ac16001e0
No known key found for this signature in database
GPG Key ID: 1E152838F164D13B
  1. 2
      lib/private/Files/Cache/Scanner.php

@ -296,6 +296,7 @@ class Scanner extends BasicEmitter implements IScanner {
} }
if ($lock) { if ($lock) {
if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) {
$this->storage->acquireLock('scanner::' . $path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider);
$this->storage->acquireLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider); $this->storage->acquireLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider);
} }
} }
@ -307,6 +308,7 @@ class Scanner extends BasicEmitter implements IScanner {
if ($lock) { if ($lock) {
if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) { if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) {
$this->storage->releaseLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider); $this->storage->releaseLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider);
$this->storage->releaseLock('scanner::' . $path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider);
} }
} }
return $data; return $data;

Loading…
Cancel
Save