Dont use a transaction in the scanner while using db based locking

This commit is contained in:
Robin Appelman 2015-10-08 15:29:04 +02:00
parent cd818e7419
commit 7ff5a6ccf4
1 changed files with 8 additions and 2 deletions

View File

@ -31,6 +31,7 @@ use OC\Files\Cache\ChangePropagator;
use OC\Files\Filesystem; use OC\Files\Filesystem;
use OC\ForbiddenException; use OC\ForbiddenException;
use OC\Hooks\PublicEmitter; use OC\Hooks\PublicEmitter;
use OC\Lock\DBLockingProvider;
/** /**
* Class Scanner * Class Scanner
@ -156,10 +157,15 @@ class Scanner extends PublicEmitter {
$scanner = $storage->getScanner(); $scanner = $storage->getScanner();
$scanner->setUseTransactions(false); $scanner->setUseTransactions(false);
$this->attachListener($mount); $this->attachListener($mount);
$isDbLocking = \OC::$server->getLockingProvider() instanceof DBLockingProvider;
if (!$isDbLocking) {
$this->db->beginTransaction(); $this->db->beginTransaction();
}
$scanner->scan($relativePath, \OC\Files\Cache\Scanner::SCAN_RECURSIVE, \OC\Files\Cache\Scanner::REUSE_ETAG | \OC\Files\Cache\Scanner::REUSE_SIZE); $scanner->scan($relativePath, \OC\Files\Cache\Scanner::SCAN_RECURSIVE, \OC\Files\Cache\Scanner::REUSE_ETAG | \OC\Files\Cache\Scanner::REUSE_SIZE);
if (!$isDbLocking) {
$this->db->commit(); $this->db->commit();
} }
}
$this->propagator->propagateChanges(time()); $this->propagator->propagateChanges(time());
} }
} }