From 651b7b21417d54924c2dcbfc0fbaf2b4ee2858f8 Mon Sep 17 00:00:00 2001 From: Kirill Popov Date: Sat, 23 Apr 2022 16:42:37 +0300 Subject: [PATCH] Get not only time-sensitive next job from list but any Before the change webcron used to select **only** time-sensitive tasks. Signed-off-by: Kirill Popov --- cron.php | 2 ++ lib/private/BackgroundJob/JobList.php | 2 +- tests/lib/BackgroundJob/DummyJobList.php | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cron.php b/cron.php index 0abfee14f28..4ee5bbb6d9b 100644 --- a/cron.php +++ b/cron.php @@ -146,6 +146,7 @@ try { break; } + $logger->debug('CLI cron call has selected job with ID ' . strval($job->getId()), ['app' => 'cron']); $job->execute($jobList, $logger); // clean up after unclean jobs \OC_Util::tearDownFS(); @@ -168,6 +169,7 @@ try { $jobList = \OC::$server->getJobList(); $job = $jobList->getNext(); if ($job != null) { + $logger->debug('WebCron call has selected job with ID ' . strval($job->getId()), ['app' => 'cron']); $job->execute($jobList, $logger); $jobList->setLastJob($job); } diff --git a/lib/private/BackgroundJob/JobList.php b/lib/private/BackgroundJob/JobList.php index 887a3343166..5a4cb24de3c 100644 --- a/lib/private/BackgroundJob/JobList.php +++ b/lib/private/BackgroundJob/JobList.php @@ -187,7 +187,7 @@ class JobList implements IJobList { * @param bool $onlyTimeSensitive * @return IJob|null */ - public function getNext(bool $onlyTimeSensitive = true): ?IJob { + public function getNext(bool $onlyTimeSensitive = false): ?IJob { $query = $this->connection->getQueryBuilder(); $query->select('*') ->from('jobs') diff --git a/tests/lib/BackgroundJob/DummyJobList.php b/tests/lib/BackgroundJob/DummyJobList.php index 1c899f35e2a..285212bcb6a 100644 --- a/tests/lib/BackgroundJob/DummyJobList.php +++ b/tests/lib/BackgroundJob/DummyJobList.php @@ -78,7 +78,7 @@ class DummyJobList extends \OC\BackgroundJob\JobList { * @param bool $onlyTimeSensitive * @return IJob|null */ - public function getNext(bool $onlyTimeSensitive = true): ?IJob { + public function getNext(bool $onlyTimeSensitive = false): ?IJob { if (count($this->jobs) > 0) { if ($this->last < (count($this->jobs) - 1)) { $i = $this->last + 1;