diff --git a/classes/task/ProcessQueueJobs.php b/classes/task/ProcessQueueJobs.php index 42e5b84aacf..9d8791b324b 100644 --- a/classes/task/ProcessQueueJobs.php +++ b/classes/task/ProcessQueueJobs.php @@ -37,7 +37,7 @@ public function getName() */ public function executeActions() { - if (Application::isUnderMaintenance()) { + if (Application::isUnderMaintenance() || !Config::getVar('queues', 'job_runner', true)) { return true; } @@ -49,7 +49,7 @@ public function executeActions() return true; } - // Run queue jobs on CLI + // Executes all pending jobs when running the runScheduledTasks.php on the CLI if (runOnCLI('runScheduledTasks.php')) { while ($jobBuilder->count()) { $jobQueue->runJobInQueue(); @@ -58,15 +58,13 @@ public function executeActions() return true; } - // Run queue jobs off CLI - if (Config::getVar('queues', 'job_runner', false)) { - (new JobRunner($jobQueue)) - ->withMaxExecutionTimeConstrain() - ->withMaxJobsConstrain() - ->withMaxMemoryConstrain() - ->withEstimatedTimeToProcessNextJobConstrain() - ->processJobs($jobBuilder); - } + // Executes a limited number of jobs when processing a request + (new JobRunner($jobQueue)) + ->withMaxExecutionTimeConstrain() + ->withMaxJobsConstrain() + ->withMaxMemoryConstrain() + ->withEstimatedTimeToProcessNextJobConstrain() + ->processJobs($jobBuilder); return true; }