Store the shared propagator instance
This instead of recreating it for every call.
This commit is contained in:
parent
d6bee61131
commit
412b5c5407
|
@ -319,10 +319,15 @@ class Shared extends \OC\Files\Storage\Wrapper\Jail implements ISharedStorage {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPropagator($storage = null) {
|
public function getPropagator($storage = null) {
|
||||||
|
if (isset($this->propagator)) {
|
||||||
|
return $this->propagator;
|
||||||
|
}
|
||||||
|
|
||||||
if (!$storage) {
|
if (!$storage) {
|
||||||
$storage = $this;
|
$storage = $this;
|
||||||
}
|
}
|
||||||
return new \OCA\Files_Sharing\SharedPropagator($storage, \OC::$server->getDatabaseConnection());
|
$this->propagator = new \OCA\Files_Sharing\SharedPropagator($storage, \OC::$server->getDatabaseConnection());
|
||||||
|
return $this->propagator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOwner($path) {
|
public function getOwner($path) {
|
||||||
|
|
|
@ -139,9 +139,10 @@ class Scanner extends PublicEmitter {
|
||||||
$this->triggerPropagator($storage, $path);
|
$this->triggerPropagator($storage, $path);
|
||||||
});
|
});
|
||||||
|
|
||||||
$storage->getPropagator()->beginBatch();
|
$propagator = $storage->getPropagator();
|
||||||
|
$propagator->beginBatch();
|
||||||
$scanner->backgroundScan();
|
$scanner->backgroundScan();
|
||||||
$storage->getPropagator()->commitBatch();
|
$propagator->commitBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,14 +191,15 @@ class Scanner extends PublicEmitter {
|
||||||
$this->db->beginTransaction();
|
$this->db->beginTransaction();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$storage->getPropagator()->beginBatch();
|
$propagator = $storage->getPropagator();
|
||||||
|
$propagator->beginBatch();
|
||||||
$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);
|
||||||
$cache = $storage->getCache();
|
$cache = $storage->getCache();
|
||||||
if ($cache instanceof Cache) {
|
if ($cache instanceof Cache) {
|
||||||
// only re-calculate for the root folder we scanned, anything below that is taken care of by the scanner
|
// only re-calculate for the root folder we scanned, anything below that is taken care of by the scanner
|
||||||
$cache->correctFolderSize($relativePath);
|
$cache->correctFolderSize($relativePath);
|
||||||
}
|
}
|
||||||
$storage->getPropagator()->commitBatch();
|
$propagator->commitBatch();
|
||||||
} catch (StorageNotAvailableException $e) {
|
} catch (StorageNotAvailableException $e) {
|
||||||
$this->logger->error('Storage ' . $storage->getId() . ' not available');
|
$this->logger->error('Storage ' . $storage->getId() . ' not available');
|
||||||
$this->logger->logException($e);
|
$this->logger->logException($e);
|
||||||
|
|
Loading…
Reference in New Issue