Browse Source

Prevent double execution

pull/1912/head
Michael Vogel 5 years ago
parent
commit
f0cf9ce519
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      include/poller.php

+ 8
- 1
include/poller.php View File

@ -76,11 +76,18 @@ function poller_run(&$argv, &$argc){
if (poller_too_much_workers())
return;
q("UPDATE `workerqueue` SET `executed` = '%s', `pid` = %d WHERE `id` = %d",
q("UPDATE `workerqueue` SET `executed` = '%s', `pid` = %d WHERE `id` = %d AND `executed` = '0000-00-00 00:00:00'",
dbesc(datetime_convert()),
intval(getmypid()),
intval($r[0]["id"]));
// Assure that there are no tasks executed twice
$id = q("SELECT `id` FROM `workerqueue` WHERE `id` = %d AND `pid` = %d",
intval($r[0]["id"]),
intval(getmypid()));
if (!$id)
continue;
$argv = json_decode($r[0]["parameter"]);
$argc = count($argv);


Loading…
Cancel
Save