diff options
author | Simon L <szaimen@e.mail.de> | 2023-04-27 09:43:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-27 09:43:03 +0200 |
commit | 2a64c4fc39ac74df29608783198af34cb692c691 (patch) | |
tree | 9c8a1af6d15a16e7f87d541b46cd203ded3f2924 | |
parent | 00845e12cde1a70bde250c71470b52cb4acf2144 (diff) | |
parent | a7b4d7bdc20be51b8dd0067f07eeb5d50dc95c0c (diff) | |
download | nextcloud-server-2a64c4fc39ac74df29608783198af34cb692c691.tar.gz nextcloud-server-2a64c4fc39ac74df29608783198af34cb692c691.zip |
Merge pull request #37875 from nextcloud/backport/37820/stable26
[stable26] ignore errors while trying to update parent storage_mtime
-rw-r--r-- | lib/private/Files/Cache/Updater.php | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/private/Files/Cache/Updater.php b/lib/private/Files/Cache/Updater.php index f8c187996e6..d94cff0685d 100644 --- a/lib/private/Files/Cache/Updater.php +++ b/lib/private/Files/Cache/Updater.php @@ -27,10 +27,12 @@ */ namespace OC\Files\Cache; +use OC\DB\Exceptions\DbalException; use OC\Files\FileInfo; use OCP\Files\Cache\ICacheEntry; use OCP\Files\Cache\IUpdater; use OCP\Files\Storage\IStorage; +use Psr\Log\LoggerInterface; /** * Update the cache and propagate changes @@ -62,6 +64,8 @@ class Updater implements IUpdater { */ protected $cache; + private LoggerInterface $logger; + /** * @param \OC\Files\Storage\Storage $storage */ @@ -70,6 +74,7 @@ class Updater implements IUpdater { $this->propagator = $storage->getPropagator(); $this->scanner = $storage->getScanner(); $this->cache = $storage->getCache(); + $this->logger = \OC::$server->get(LoggerInterface::class); } /** @@ -253,7 +258,14 @@ class Updater implements IUpdater { if ($parentId != -1) { $mtime = $this->storage->filemtime($parent); if ($mtime !== false) { - $this->cache->update($parentId, ['storage_mtime' => $mtime]); + try { + $this->cache->update($parentId, ['storage_mtime' => $mtime]); + } catch (DbalException $e) { + // ignore the failure. + // with failures concurrent updates, someone else would have already done it. + // in the worst case the `storage_mtime` isn't updated, which should at most only trigger an extra rescan + $this->logger->warning("Error while updating parent storage_mtime, should be safe to ignore", ['exception' => $e]); + } } } } |