Skip to content

Commit 13d273f

Browse files
committed
fix(FileListener): Address review comments
Signed-off-by: Marcel Klehr <[email protected]>
1 parent db462d8 commit 13d273f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/Hooks/FileListener.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ private function resetIgnoreCache(Node $node) : void {
544544
private function onAccessUpdate(int $storageId, int $rootId): void {
545545
$userIds = $this->getUsersWithFileAccess($rootId);
546546
$files = $this->storageService->getFilesInMount($storageId, $rootId, [ClusteringFaceClassifier::MODEL_NAME], 0, 0);
547+
$userIdsToScheduleClustering = [];
547548
foreach ($files as $fileInfo) {
548549
$node = current($this->rootFolder->getById($fileInfo['fileid'])) ?: null;
549550
$ownerId = $node?->getOwner()?->getUID();
@@ -563,9 +564,12 @@ private function onAccessUpdate(int $storageId, int $rootId): void {
563564
continue;
564565
}
565566
$this->faceDetectionMapper->copyDetectionsForFileFromUserToUser($fileInfo['fileid'], $ownerId, $userId);
566-
$this->jobList->add(ClusterFacesJob::class, ['userId' => $userId]);
567+
$userIdsToScheduleClustering[$userId] = true;
567568
}
568569
$this->faceDetectionMapper->removeDetectionsForFileFromUsersNotInList($fileInfo['fileid'], $userIds);
569570
}
571+
foreach (array_keys($userIdsToScheduleClustering) as $userId) {
572+
$this->jobList->add(ClusterFacesJob::class, ['userId' => $userId]);
573+
}
570574
}
571575
}

0 commit comments

Comments
 (0)