Added lastrun to database

This commit is contained in:
Jeroen De Meerleer 2019-05-24 18:22:17 +02:00
parent 6104aadbf5
commit 8a46143b5d
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
2 changed files with 2 additions and 1 deletions

View File

@ -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;

View File

@ -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();