MDL-73923 tool_task: make a more relaxed check on cron run interval

Prior to this change, the tool_task_cronrunning check had very tight
limits for checking the last cron interval and comparing it to the
expected frequency. When a cron job should take 1:00 min and the last
run was 1:02 min it complained that there was 1:02 between the last two
runs of the cron maintenance script and it should run every 1:00.

This change makes the check a bit more relaxed and adds an additional
minute on top of the expectedfrequency to give the cron job some time.

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
This commit is contained in:
Daniel Ziegenberg 2022-02-17 19:54:41 +01:00
parent 1d99ba19a2
commit a4d64bd71b
No known key found for this signature in database
GPG Key ID: 7E6F98FFADBEFD39

View File

@ -109,7 +109,8 @@ class cronrunning extends check {
return new result($status, $summary, $details);
}
if ($lastcroninterval > $expectedfrequency) {
// Add MINSECS to avoid spurious warning if cron is only a few seconds overdue.
if ($lastcroninterval > $expectedfrequency + MINSECS) {
$status = result::WARNING;
$summary = get_string('croninfrequent', 'admin', [
'actual' => $formatinterval,