diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-08-24 16:42:53 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-08-24 16:42:53 +0200 |
commit | fe575feca85ee6e6bb7b8b423a60d377bd364193 (patch) | |
tree | b2a93228e59c6c9eac12e9bc2857c1ad5cc43d05 /lib | |
parent | a67a2272e77485391695af84644e7a9074e50af8 (diff) | |
download | nextcloud-server-fe575feca85ee6e6bb7b8b423a60d377bd364193.tar.gz nextcloud-server-fe575feca85ee6e6bb7b8b423a60d377bd364193.zip |
Prevent scanner going crazy with unavailable storages
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/files/cache/scanner.php | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/private/files/cache/scanner.php b/lib/private/files/cache/scanner.php index 7c65c721352..f76ef5ba0dd 100644 --- a/lib/private/files/cache/scanner.php +++ b/lib/private/files/cache/scanner.php @@ -416,11 +416,21 @@ class Scanner extends BasicEmitter { public function backgroundScan() { $lastPath = null; while (($path = $this->cache->getIncomplete()) !== false && $path !== $lastPath) { - $this->scan($path, self::SCAN_RECURSIVE, self::REUSE_ETAG); - \OC_Hook::emit('Scanner', 'correctFolderSize', array('path' => $path)); - if ($this->cacheActive) { - $this->cache->correctFolderSize($path); + try { + $this->scan($path, self::SCAN_RECURSIVE, self::REUSE_ETAG); + \OC_Hook::emit('Scanner', 'correctFolderSize', array('path' => $path)); + if ($this->cacheActive) { + $this->cache->correctFolderSize($path); + } + } catch (\OCP\Files\StorageInvalidException $e) { + // skip unavailable storages + } catch (\OCP\Files\StorageNotAvailableException $e) { + // skip unavailable storages + } catch (\OCP\Lock\LockedException $e) { + // skip unavailable storages } + // FIXME: this won't proceed with the next item, needs revamping of getIncomplete() + // to make this possible $lastPath = $path; } } |