Nextrun rescheduled

This commit is contained in:
Jeroen De Meerleer 2018-08-31 16:30:49 +02:00
parent 0a664a8a76
commit 3c75f7c9d4
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
1 changed files with 5 additions and 2 deletions

View File

@ -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"]));