diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2021-12-21 15:10:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-21 15:10:50 +0100 |
commit | 0b01103137aea94c65f784980dfec645958faaf7 (patch) | |
tree | fba5e98b24c0fdb164a93e7eba3c46d032ca9420 /apps/files_trashbin | |
parent | 1acfbd0b061a26f9e466448d756296296e356fc2 (diff) | |
parent | 1c736abc352e27231e046ea249be5a51f3b3f4d7 (diff) | |
download | nextcloud-server-0b01103137aea94c65f784980dfec645958faaf7.tar.gz nextcloud-server-0b01103137aea94c65f784980dfec645958faaf7.zip |
Merge pull request #28438 from csware/issue-1649
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r-- | apps/files_trashbin/lib/Trashbin.php | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index 0e16c56ed8d..6aec2f9821e 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -968,9 +968,20 @@ class Trashbin { [$storage,] = $view->resolvePath('/'); //force rescan of versions, local storage may not have updated the cache - if (!self::$scannedVersions) { - $storage->getScanner()->scan('files_trashbin/versions'); - self::$scannedVersions = true; + $waitstart = time(); + while (!self::$scannedVersions) { + try { + $storage->getScanner()->scan('files_trashbin/versions'); + self::$scannedVersions = true; + } catch (LockedException $e) { + /* a concurrent remove/restore from trash occurred, + * retry with a maximum wait time of approx. 15 seconds + */ + if (time() - $waitstart > 15) { + throw $e; + } + usleep(50000 + rand(0, 10000)); + } } $pattern = \OC::$server->getDatabaseConnection()->escapeLikeParameter(basename($filename)); |