Skip to content

Commit

Permalink
Merge pull request #30391 from nextcloud/backport/28438/stable22
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Dec 30, 2021
2 parents 6c051b2 + d90bf1a commit e5a6584
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions apps/files_trashbin/lib/Trashbin.php
Original file line number Diff line number Diff line change
Expand Up @@ -968,9 +968,20 @@ private static function getVersionsFromTrash($filename, $timestamp, $user) {
[$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));
Expand Down

0 comments on commit e5a6584

Please sign in to comment.