Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get not only time-sensitive next job from list but any when not in cron-mode #32109

Merged
merged 1 commit into from Apr 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions cron.php
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
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 {
nickvergessen marked this conversation as resolved.
Show resolved Hide resolved
$query = $this->connection->getQueryBuilder();
$query->select('*')
->from('jobs')
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/BackgroundJob/DummyJobList.php
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