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

[5.3] Improve inline comment for the "none-ID" behavior within the CRON Scheduler #43817

Merged
merged 19 commits into from
Jan 7, 2025
Merged
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions plugins/system/schedulerunner/src/Extension/ScheduleRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,34 @@ public function runWebCron(Event $event)
throw new \Exception($this->getApplication()->getLanguage()->_('JERROR_ALERTNOAUTHOR'), 403);
}

$id = (int) $this->getApplication()->getInput()->getInt('id', 0);
// Check whether we have passed a taskId via URL parameter
$taskId = $this->getApplication()->getInput()->getInt('id', 0);
$scheduler = new Scheduler();
zero-24 marked this conversation as resolved.
Show resolved Hide resolved

$task = $this->runScheduler($id);
if ($taskId) {
$records[] = $scheduler->fetchTaskRecord($taskId);
} else {
$filters = $scheduler::TASK_QUEUE_FILTERS;
$listConfig = $scheduler::TASK_QUEUE_LIST_CONFIG;

// Make sure we only get one task at the time
$listConfig['limit'] = 1;

if (!empty($task) && !empty($task->getContent()['exception'])) {
throw $task->getContent()['exception'];
// Get tasks to run
$records = $scheduler->fetchTaskRecords($filters, $listConfig);
}

if (\count($records) === 0) {
// No tasks to run
return;
}

foreach ($records as $record) {
$task = $this->runScheduler($record->id);

if (!empty($task) && !empty($task->getContent()['exception'])) {
throw $task->getContent()['exception'];
}
}
}

Expand Down