diff --git a/lib/BackgroundJob/PreviewEnhancementProcessingJob.php b/lib/BackgroundJob/PreviewEnhancementProcessingJob.php index 947c805667..e34a0f9aa8 100644 --- a/lib/BackgroundJob/PreviewEnhancementProcessingJob.php +++ b/lib/BackgroundJob/PreviewEnhancementProcessingJob.php @@ -35,8 +35,9 @@ public function __construct( $this->userManager = $userManager; $this->jobList = $jobList; - $this->setInterval(3600); - $this->setTimeSensitivity(self::TIME_SENSITIVE); + // Background pre-warm only; previews are computed on demand on mailbox open, so run rarely and defer under load + $this->setInterval(24 * 3600); + $this->setTimeSensitivity(self::TIME_INSENSITIVE); } /** diff --git a/tests/Unit/BackgroundJob/PreviewEnhancementProcessingJobTest.php b/tests/Unit/BackgroundJob/PreviewEnhancementProcessingJobTest.php new file mode 100644 index 0000000000..9c62882676 --- /dev/null +++ b/tests/Unit/BackgroundJob/PreviewEnhancementProcessingJobTest.php @@ -0,0 +1,56 @@ +time = $this->createMock(ITimeFactory::class); + $this->userManager = $this->createMock(IUserManager::class); + $this->accountService = $this->createMock(AccountService::class); + $this->preprocessingService = $this->createMock(PreprocessingService::class); + $this->logger = $this->createMock(LoggerInterface::class); + $this->jobList = $this->createMock(IJobList::class); + + $this->job = new PreviewEnhancementProcessingJob( + $this->time, + $this->userManager, + $this->accountService, + $this->preprocessingService, + $this->logger, + $this->jobList, + ); + } + + public function testRunsDailyAndDeferrableUnderLoad(): void { + self::assertSame(24 * 3600, $this->job->getInterval()); + self::assertFalse($this->job->isTimeSensitive()); + } +}