]> source.dussan.org Git - nextcloud-server.git/commitdiff
Get not only time-sensitive next job from list but any 32116/head
authorKirill Popov <kirill.s.popov@gmail.com>
Sat, 23 Apr 2022 13:42:37 +0000 (16:42 +0300)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Mon, 25 Apr 2022 10:34:09 +0000 (10:34 +0000)
Before the change webcron used to select
**only** time-sensitive tasks.

Signed-off-by: Kirill Popov <kirill.s.popov@gmail.com>
cron.php
lib/private/BackgroundJob/JobList.php
tests/lib/BackgroundJob/DummyJobList.php

index 5095a2c7574888d09afb7239ccc06e12126ac7d2..a58ef2c206fb3ac8240e816a9157e98704b19233 100644 (file)
--- a/cron.php
+++ b/cron.php
@@ -147,6 +147,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();
@@ -169,6 +170,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);
                        }
index 21af79c46866dda5523b5c105ccdaea37e5e3194..fe65a1879bcc49b8b2662d3a39d1f104f1356bb6 100644 (file)
@@ -203,7 +203,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')
index ec06203a4772ec872c6e7d07e43234f464a828ba..0751409f62cb1ad7c770908ff169a94ecd847a1a 100644 (file)
@@ -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;