summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2025-05-02 14:03:45 +0300
committerAndrew Dolgov <fox@fakecake.org>2025-05-02 14:03:45 +0300
commitdc6ea08ca490c889f4e85bd697e6bdffb95a22f4 (patch)
tree8549015c688cb4af2f598e1117f6972849105c72
parent247efe3137fadf5d74ab254cf4c80957624abc90 (diff)
add workaround for due tasks because housekeeping is not run every minute, fix last_run not updated to NOW() in the db
-rw-r--r--classes/PluginHost.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/classes/PluginHost.php b/classes/PluginHost.php
index 9bdf7c0b4..8bde8df3f 100644
--- a/classes/PluginHost.php
+++ b/classes/PluginHost.php
@@ -965,7 +965,9 @@ class PluginHost {
Debug::log("Checking scheduled task: $task_name, last run: $last_run");
- if ($task['cron']->isDue($last_run)) {
+ // because we don't schedule tasks every minute, we assume that task is due if its
+ // next estimated run based on previous timestamp is in the past
+ if ($task['cron']->getNextRunDate($last_run)->getTimestamp() - time() < 0) {
Debug::log("Task $task_name is due, executing...");
$task_started = time();
@@ -977,7 +979,7 @@ class PluginHost {
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_run = Db::NOW();
$task_record->last_duration = $task_duration;
$task_record->last_rc = $rc;