Fix scanner after review

This commit is contained in:
Vincent Petry 2017-04-03 11:49:30 +02:00 committed by Joas Schilling
parent e3218ddffd
commit 0721a7d5cc
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
1 changed files with 3 additions and 2 deletions

View File

@ -87,6 +87,7 @@ class Scanner extends PublicEmitter {
$this->logger = $logger;
$this->user = $user;
$this->db = $db;
// when DB locking is used, no DB transactions will be used
$this->useTransaction = !(\OC::$server->getLockingProvider() instanceof DBLockingProvider);
}
@ -262,10 +263,10 @@ class Scanner extends PublicEmitter {
private function postProcessEntry(IStorage $storage, $internalPath) {
$this->triggerPropagator($storage, $internalPath);
$this->entriesToCommit++;
if ($this->useTransaction) {
$propagator = $storage->getPropagator();
$this->entriesToCommit++;
if ($this->entriesToCommit >= self::MAX_ENTRIES_TO_COMMIT) {
$propagator = $storage->getPropagator();
$this->entriesToCommit = 0;
$this->db->commit();
$propagator->commitBatch();