From 3c0cbd9bfd824865c5cdbda2031b30c7f770d21a Mon Sep 17 00:00:00 2001 From: Sven Hansen Date: Sat, 15 Aug 2026 22:46:12 +0200 Subject: [PATCH] fix(jobs): don't overwrite the --stop_after baseline in background-job:worker $startTime was used for two different things: as baseline for --stop_after and as start time of the currently running job. The variable was reassigned during each loop with each new job in the queue, so the baseline for --stop_after was lost and the worker never terminated. Renaming the job variable fixes this issue. Assisted-by: Claude:claude-opus-5 Signed-off-by: Sven Hansen --- core/Command/Background/JobWorker.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/Command/Background/JobWorker.php b/core/Command/Background/JobWorker.php index 747e8ce79fca1..ad30e3e9f7bf2 100644 --- a/core/Command/Background/JobWorker.php +++ b/core/Command/Background/JobWorker.php @@ -139,9 +139,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int memory_reset_peak_usage(); $jobClassId = $this->jobClassesRegistry->getId($jobClassName); $jobRunId = $this->jobRuns->started($jobClassId); - $startTime = microtime(true); + $jobStartTime = microtime(true); $job->start($this->jobList); - $timeSpent = microtime(true) - $startTime; + $timeSpent = microtime(true) - $jobStartTime; $jobMemoryPeak = memory_get_peak_usage(); // TODO Job failure will never be catched here because exceptions are catched within $job->start method // The error will only be visible in server logs.