MDL-81689 tests: Check task DB record for nextruntime

This commit is contained in:
Johannes Burk
2024-07-26 10:36:29 +02:00
parent 0ae247b51f
commit 30bae49637
+5 -2
View File
@@ -879,8 +879,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]);