From 71247f22ef575675db2bc28a46bb2e2ab2f4a0e7 Mon Sep 17 00:00:00 2001 From: Louis Chemineau Date: Thu, 11 Jul 2024 14:55:30 +0200 Subject: [PATCH] fix(files_metadata): Don't run generation job on every upgrade Signed-off-by: Louis Chemineau --- core/BackgroundJobs/GenerateMetadataJob.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/BackgroundJobs/GenerateMetadataJob.php b/core/BackgroundJobs/GenerateMetadataJob.php index 65a687649b833..bcdaf23051c88 100644 --- a/core/BackgroundJobs/GenerateMetadataJob.php +++ b/core/BackgroundJobs/GenerateMetadataJob.php @@ -53,9 +53,14 @@ public function __construct( } protected function run(mixed $argument): void { - $users = $this->userManager->search(''); + if ($this->config->getAppValue('core', 'metadataGenerationDone', 'false') !== 'false') { + return; + } + $lastHandledUser = $this->config->getAppValue('core', 'metadataGenerationLastHandledUser', ''); + $users = $this->userManager->search(''); + // we'll only start timer once we have found a valid user to handle // meaning NOW if we have not handled any user from a previous run $startTime = ($lastHandledUser === '') ? time() : null; @@ -79,8 +84,8 @@ protected function run(mixed $argument): void { } } - $this->jobList->remove(GenerateMetadataJob::class); $this->config->deleteAppValue('core', 'metadataGenerationLastHandledUser'); + $this->config->setAppValue('core', 'metadataGenerationDone', 'true'); } private function scanFilesForUser(string $userId): void {