mirror of
https://github.com/nextcloud/server.git
synced 2026-03-13 14:19:06 -04:00
Merge pull request #36746 from nextcloud/backport/36465/stable24
[stable24] Avoid locking on restore/delete and limit concurrent requests
This commit is contained in:
commit
f101ef3d4d
1 changed files with 0 additions and 24 deletions
|
|
@ -67,13 +67,6 @@ class Trashbin {
|
|||
// unit: percentage; 50% of available disk space/quota
|
||||
public const DEFAULTMAXSIZE = 50;
|
||||
|
||||
/**
|
||||
* Whether versions have already be rescanned during this PHP request
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private static $scannedVersions = false;
|
||||
|
||||
/**
|
||||
* Ensure we don't need to scan the file during the move to trash
|
||||
* by triggering the scan in the pre-hook
|
||||
|
|
@ -973,23 +966,6 @@ class Trashbin {
|
|||
/** @var \OC\Files\Storage\Storage $storage */
|
||||
[$storage,] = $view->resolvePath('/');
|
||||
|
||||
//force rescan of versions, local storage may not have updated the cache
|
||||
$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));
|
||||
if ($timestamp) {
|
||||
// fetch for old versions
|
||||
|
|
|
|||
Loading…
Reference in a new issue