poller.php is now working with transactions as well.
This commit is contained in:
parent
1ade94fd8a
commit
47b8975bb6
1 changed files with 9 additions and 2 deletions
|
@ -98,6 +98,7 @@ function poller_run(&$argv, &$argc){
|
||||||
|
|
||||||
if (!$upd) {
|
if (!$upd) {
|
||||||
logger("Couldn't update queue entry ".$r[0]["id"]." - skip this execution", LOGGER_DEBUG);
|
logger("Couldn't update queue entry ".$r[0]["id"]." - skip this execution", LOGGER_DEBUG);
|
||||||
|
q("COMMIT");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,14 +106,18 @@ function poller_run(&$argv, &$argc){
|
||||||
$id = q("SELECT `pid`, `executed` FROM `workerqueue` WHERE `id` = %d", intval($r[0]["id"]));
|
$id = q("SELECT `pid`, `executed` FROM `workerqueue` WHERE `id` = %d", intval($r[0]["id"]));
|
||||||
if (!$id) {
|
if (!$id) {
|
||||||
logger("Queue item ".$r[0]["id"]." vanished - skip this execution", LOGGER_DEBUG);
|
logger("Queue item ".$r[0]["id"]." vanished - skip this execution", LOGGER_DEBUG);
|
||||||
|
q("COMMIT");
|
||||||
continue;
|
continue;
|
||||||
} elseif ((strtotime($id[0]["executed"]) <= 0) OR ($id[0]["pid"] == 0)) {
|
} elseif ((strtotime($id[0]["executed"]) <= 0) OR ($id[0]["pid"] == 0)) {
|
||||||
logger("Entry for queue item ".$r[0]["id"]." wasn't stored - we better stop here", LOGGER_DEBUG);
|
logger("Entry for queue item ".$r[0]["id"]." wasn't stored - skip this execution", LOGGER_DEBUG);
|
||||||
return;
|
q("COMMIT");
|
||||||
|
continue;
|
||||||
} elseif ($id[0]["pid"] != $mypid) {
|
} elseif ($id[0]["pid"] != $mypid) {
|
||||||
logger("Queue item ".$r[0]["id"]." is to be executed by process ".$id[0]["pid"]." and not by me (".$mypid.") - skip this execution", LOGGER_DEBUG);
|
logger("Queue item ".$r[0]["id"]." is to be executed by process ".$id[0]["pid"]." and not by me (".$mypid.") - skip this execution", LOGGER_DEBUG);
|
||||||
|
q("COMMIT");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
q("COMMIT");
|
||||||
|
|
||||||
$argv = json_decode($r[0]["parameter"]);
|
$argv = json_decode($r[0]["parameter"]);
|
||||||
|
|
||||||
|
@ -433,6 +438,8 @@ function poller_passing_slow(&$highest_priority) {
|
||||||
|
|
||||||
function poller_worker_process() {
|
function poller_worker_process() {
|
||||||
|
|
||||||
|
q("START TRANSACTION;");
|
||||||
|
|
||||||
// Check if we should pass some low priority process
|
// Check if we should pass some low priority process
|
||||||
$highest_priority = 0;
|
$highest_priority = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue