Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
moodle
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
moodle
moodle
Commits
d9df954a
Commit
d9df954a
authored
Jan 12, 2021
by
Sara Arjona
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'MDL-68768-adhoc-task-faildelay-check' of
https://github.com/brendanheywood/moodle
parents
606a5345
71f18044
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
0 deletions
+34
-0
admin/tool/task/classes/check/maxfaildelay.php
admin/tool/task/classes/check/maxfaildelay.php
+13
-0
lib/classes/task/manager.php
lib/classes/task/manager.php
+21
-0
No files found.
admin/tool/task/classes/check/maxfaildelay.php
View file @
d9df954a
...
...
@@ -79,6 +79,19 @@ class maxfaildelay extends check {
}
}
$tasks
=
\core\task\manager
::
get_failed_adhoc_tasks
();
foreach
(
$tasks
as
$task
)
{
$faildelay
=
$task
->
get_fail_delay
();
if
(
$faildelay
>
$maxdelay
)
{
$maxdelay
=
$faildelay
;
}
if
(
$faildelay
>
0
)
{
$failures
++
;
$details
.=
get_string
(
'faildelay'
,
'tool_task'
)
.
': '
.
format_time
(
$faildelay
);
$details
.=
' - '
.
get_class
(
$task
)
.
" ID = "
.
$task
->
get_id
()
.
"<br>"
;
}
}
if
(
$failures
>
0
)
{
// Intermittent failures are not yet a warning.
$status
=
result
::
INFO
;
...
...
lib/classes/task/manager.php
View file @
d9df954a
...
...
@@ -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.
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment