mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 09:26:35 +02:00
Merge branch 'MDL-68768-adhoc-task-faildelay-check' of https://github.com/brendanheywood/moodle
This commit is contained in:
commit
d9df954a25
2 changed files with 34 additions and 0 deletions
|
@ -512,6 +512,27 @@ class manager {
|
|||
return $tasks;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will return a list of all adhoc tasks that have a faildelay
|
||||
*
|
||||
* @param int $delay filter how long the task has been delayed
|
||||
* @return \core\task\adhoc_task[]
|
||||
*/
|
||||
public static function get_failed_adhoc_tasks(int $delay = 0): array {
|
||||
global $DB;
|
||||
|
||||
$tasks = [];
|
||||
$records = $DB->get_records_sql('SELECT * from {task_adhoc} WHERE faildelay > ?', [$delay]);
|
||||
|
||||
foreach ($records as $record) {
|
||||
$task = self::adhoc_task_from_record($record);
|
||||
if ($task) {
|
||||
$tasks[] = $task;
|
||||
}
|
||||
}
|
||||
return $tasks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure quality of service for the ad hoc task queue.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue