MDL-81689 tests: Check task DB record for nextruntime

This commit is contained in:
Johannes Burk
2024-07-26 10:33:12 +02:00
parent c05ead813e
commit 8f86be0184
+5 -2
View File
@@ -864,8 +864,11 @@ class manager {
if ($lock = $cronlockfactory->get_lock('adhoc_' . $record->id, 0)) {
// Safety check, see if the task has been already processed by another cron run.
$record = $DB->get_record('task_adhoc', array('id' => $record->id));
// Safety check, see if the task has already been processed by another cron run (or attempted and failed).
// If another cron run attempted to process the task and failed, nextruntime will be in the future.
$record = $DB->get_record_select('task_adhoc',
"id = :id AND nextruntime < :timestart",
['id' => $record->id, 'timestart' => $timestart]);
if (!$record) {
$lock->release();
unset(self::$miniqueue[$taskid]);