aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2021-11-17 15:04:51 +0100
committerLouis (Rebase PR Action) <artonge@users.noreply.github.com>2021-12-02 20:00:45 +0000
commitac28e0aefdbaa5e5806a53f691750c47ca4c39b8 (patch)
treea579e646a65a3170e248f03f451768e0b7319850 /apps/files/lib
parent70f23a428559136f58b2ba4186c2e09f63ab7a59 (diff)
downloadnextcloud-server-ac28e0aefdbaa5e5806a53f691750c47ca4c39b8.tar.gz
nextcloud-server-ac28e0aefdbaa5e5806a53f691750c47ca4c39b8.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/lib')
-rw-r--r--apps/files/lib/BackgroundJob/ScanFiles.php8
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");
+ }
}
}