mirror of
https://github.com/nextcloud/server.git
synced 2026-04-20 22:00:39 -04:00
Don't die with LockedException when removing/restoring multiple files from trash
fixes issue #16491 Signed-off-by: Sven Strickroth <email@cs-ware.de>
This commit is contained in:
parent
35e73e4376
commit
1c736abc35
1 changed files with 14 additions and 3 deletions
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Reference in a new issue