Skip to content
Snippets Groups Projects
Unverified Commit 4ac16001 authored by Robin Appelman's avatar Robin Appelman Committed by Roeland Jago Douma
Browse files

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

parent 74de72e7
No related branches found
No related tags found
No related merge requests found
...@@ -296,6 +296,7 @@ class Scanner extends BasicEmitter implements IScanner { ...@@ -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 { ...@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment