diff options
author | Robin Appelman <robin@icewind.nl> | 2021-11-17 15:04:51 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2021-12-02 17:35:07 +0100 |
commit | 89bc9f1b77e42c1b5bde43afb3bee0f917fda441 (patch) | |
tree | ae8b6ae09db22b439eb2cf9eb0a334e16f46d85d /apps/files | |
parent | 38921ab498cb331e8bf516c2a587267266ff5a3f (diff) | |
download | nextcloud-server-89bc9f1b77e42c1b5bde43afb3bee0f917fda441.tar.gz nextcloud-server-89bc9f1b77e42c1b5bde43afb3bee0f917fda441.zip |
stop background scan early if a users still has unscanned files after background scan
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/lib/BackgroundJob/ScanFiles.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/apps/files/lib/BackgroundJob/ScanFiles.php b/apps/files/lib/BackgroundJob/ScanFiles.php index 37416aed521..250338e1262 100644 --- a/apps/files/lib/BackgroundJob/ScanFiles.php +++ b/apps/files/lib/BackgroundJob/ScanFiles.php @@ -116,11 +116,17 @@ class ScanFiles extends \OC\BackgroundJob\TimedJob { } $usersScanned = 0; + $lastUser = ''; $user = $this->getUserToScan(); - while ($user && $usersScanned < self::USERS_PER_SESSION) { + while ($user && $usersScanned < self::USERS_PER_SESSION && $lastUser !== $user) { $this->runScanner($user); + $lastUser = $user; $user = $this->getUserToScan(); $usersScanned += 1; } + + if ($lastUser === $user) { + $this->logger->warning("User $user still has unscanned files after running background scan, background scan might be stopped prematurely"); + } } } |