Skip to content

Commit

Permalink
Get not only time-sensitive next job from list but any
Browse files Browse the repository at this point in the history
Before the change webcron used to select
**only** time-sensitive tasks.

Signed-off-by: Kirill Popov <[email protected]>
  • Loading branch information
k-popov authored and backportbot[bot] committed Apr 25, 2022
1 parent f0d4716 commit edfba7f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
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();
Expand All @@ -169,6 +170,7 @@
$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);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/private/BackgroundJob/JobList.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public function getAll() {
* @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')
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/BackgroundJob/DummyJobList.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function getAll() {
* @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;
Expand Down

0 comments on commit edfba7f

Please sign in to comment.