From 5648516b1e47f3b8ec6444adea8be8c35e39f852 Mon Sep 17 00:00:00 2001 From: Matthew Hilton Date: Mon, 9 Oct 2023 15:17:47 +1000 Subject: [PATCH] [#136] Sort by cumulative faildelay --- croncheck.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/croncheck.php b/croncheck.php index d19a15d..548562c 100644 --- a/croncheck.php +++ b/croncheck.php @@ -229,10 +229,11 @@ // Instead of using task API here, we read directly from the database. // This stops errors originating from broken tasks, and allows the DB to de-duplicate them. -$adhoctasks = $DB->get_records_sql(" SELECT classname, COUNT(*) count, MAX(faildelay) faildelay +$adhoctasks = $DB->get_records_sql(" SELECT classname, COUNT(*) count, MAX(faildelay) faildelay, SUM(faildelay) cfaildelay FROM {task_adhoc} WHERE faildelay > 0 - GROUP BY classname"); + GROUP BY classname + ORDER BY cfaildelay DESC"); foreach ($adhoctasks as $record) { // Only add duplicate message if there are more than 1.