Skip to content

Commit

Permalink
Added check for tasks which no longer exist #80
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanheywood committed Jul 6, 2020
1 parent 50080ce commit f91b4d3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions croncheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,13 @@
}

$tasks = $DB->get_records('task_adhoc');
foreach ($tasks as $task) {
$task = \core\task\manager::adhoc_task_from_record($task);
foreach ($tasks as $record) {
$task = \core\task\manager::adhoc_task_from_record($record);

if (!$task) {
send_warning("TASK: id={$record->id} ({$record->classname}) does not exist and must be deleted");
continue;
}

$faildelay = $task->get_fail_delay();
if ($faildelay == 0) {
Expand Down

0 comments on commit f91b4d3

Please sign in to comment.