From 8a46143b5ddd10f44f2c357e7f265e8e65412553 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Fri, 24 May 2019 18:22:17 +0200 Subject: [PATCH] Added lastrun to database --- database.sql | 1 + webcron.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/database.sql b/database.sql index 5b4fd20..b0436fb 100644 --- a/database.sql +++ b/database.sql @@ -59,6 +59,7 @@ CREATE TABLE IF NOT EXISTS `jobs` ( `host` varchar(50) NOT NULL DEFAULT 'localhost', `delay` int(11) NOT NULL, `nextrun` int(11) NOT NULL, + `lastrun` int(11) NOT NULL DEFAULT '-1', `expected` int(11) NOT NULL DEFAULT '200', PRIMARY KEY (`jobID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/webcron.php b/webcron.php index 29a56fe..7a554f8 100644 --- a/webcron.php +++ b/webcron.php @@ -67,7 +67,7 @@ if (file_exists("cache/get-services.trigger")) { } } -$stmt = $db->prepare('SELECT jobID, url, host, delay, nextrun, expected FROM jobs WHERE nextrun <= ?'); +$stmt = $db->prepare('SELECT * FROM jobs WHERE nextrun <= 1558742600 and (nextrun <= lastrun OR lastrun = -1)'); $stmt->execute(array(time())); $results = $stmt->fetchAll(PDO::FETCH_ASSOC); $client = new \GuzzleHttp\Client();