From 3c75f7c9d43a1c0fb9728a2715385eef155904f8 Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 31 Aug 2018 16:30:49 +0200 Subject: [PATCH] Nextrun rescheduled --- webcron.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/webcron.php b/webcron.php index fe368db..c6bfe12 100644 --- a/webcron.php +++ b/webcron.php @@ -96,8 +96,11 @@ foreach ($results as $result) { $stmt = $db->prepare("INSERT INTO runs(job, statuscode, result, timestamp) VALUES(?, ?, ?, ?)"); $stmt->execute(array($result['jobID'], $statuscode, $body, time())); } - $nextrun = $result['nextrun'] + $result['delay']; - if ($nextrun < time() ) { $nextrun = time() + $result['delay']; } + + $nextrun = $result['nextrun']; + do { + $nextrun = $nextrun + $result['delay']; + } while ($nextrun < time()) $nexttime = $db->prepare("UPDATE jobs SET nextrun = ? WHERE jobID = ?"); $nexttime->execute(array($nextrun, $result["jobID"]));