mirror of
https://github.com/nextcloud/server.git
synced 2025-10-26 19:21:34 +00:00
Merge pull request #24205 from owncloud/scanner-locking
add locks in the scanner to prevent multiple scanners running on the …
This commit is contained in:
commit
5348424417
@ -296,6 +296,7 @@ class Scanner extends BasicEmitter implements IScanner {
|
||||
}
|
||||
if ($lock) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -307,6 +308,7 @@ class Scanner extends BasicEmitter implements IScanner {
|
||||
if ($lock) {
|
||||
if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) {
|
||||
$this->storage->releaseLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider);
|
||||
$this->storage->releaseLock('scanner::' . $path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider);
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user