diff options
| author | Andrew Dolgov <fox@fakecake.org> | 2025-05-02 10:23:30 +0300 |
|---|---|---|
| committer | Andrew Dolgov <fox@fakecake.org> | 2025-05-02 10:23:30 +0300 |
| commit | a268f52de695fffb29769960332bfb34fe3ac7b5 (patch) | |
| tree | 76aea12e8a45115da93dc7a53ee8b71038aeb4d9 /classes | |
| parent | 6a40940ad6c6facea6c8e9d0dc1896885168c442 (diff) | |
record task duration in seconds
Diffstat (limited to 'classes')
| -rw-r--r-- | classes/PluginHost.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/classes/PluginHost.php b/classes/PluginHost.php index 484364f26..e417fde1f 100644 --- a/classes/PluginHost.php +++ b/classes/PluginHost.php @@ -968,12 +968,15 @@ class PluginHost { if ($task['cron']->isDue($last_run)) { Debug::log("Task $task_name is due, executing..."); + $task_started = time(); $rc = (int) $task['callback'](); + $task_duration = time() - $task_started; - Debug::log("Task $task_name has finished with RC=$rc, recording timestamp..."); + Debug::log("Task $task_name has finished in $task_duration seconds with RC=$rc, recording timestamp..."); if ($task_record) { $task_record->last_run = time(); + $task_record->last_duration = $task_duration; $task_record->last_rc = $rc; $task_record->save(); @@ -982,6 +985,7 @@ class PluginHost { $task_record->set([ 'task_name' => $task_name, + 'last_duration' => $task_duration, 'last_rc' => $rc, 'last_run' => Db::NOW(), ]); |