Skip to content

Commit 303f05f

Browse files
icewind1991backportbot[bot]
authored andcommitted
stop background scan early if a users still has unscanned files after background scan
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 6b05b81 commit 303f05f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

apps/files/lib/BackgroundJob/ScanFiles.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,17 @@ protected function run($argument) {
116116
}
117117

118118
$usersScanned = 0;
119+
$lastUser = '';
119120
$user = $this->getUserToScan();
120-
while ($user && $usersScanned < self::USERS_PER_SESSION) {
121+
while ($user && $usersScanned < self::USERS_PER_SESSION && $lastUser !== $user) {
121122
$this->runScanner($user);
123+
$lastUser = $user;
122124
$user = $this->getUserToScan();
123125
$usersScanned += 1;
124126
}
127+
128+
if ($lastUser === $user) {
129+
$this->logger->warning("User $user still has unscanned files after running background scan, background scan might be stopped prematurely");
130+
}
125131
}
126132
}

0 commit comments

Comments
 (0)