X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fpoller.php;h=5560b3340e6209fc4ab82c97ecd3619bc9840afc;hb=0b8f80c7476726007404c617171636bd477b7770;hp=487c86ab3002670516b02297eba0b1d380607bf6;hpb=e301fa083291f2df98192532c9c5cba03abfeb5a;p=friendica.git diff --git a/include/poller.php b/include/poller.php index 487c86ab30..5560b3340e 100644 --- a/include/poller.php +++ b/include/poller.php @@ -364,11 +364,11 @@ function poller_kill_stale_workers() { return; } - foreach($r AS $pid) - if (!posix_kill($pid["pid"], 0)) + foreach ($r AS $pid) { + if (!posix_kill($pid["pid"], 0)) { q("UPDATE `workerqueue` SET `executed` = '%s', `pid` = 0 WHERE `pid` = %d", dbesc(NULL_DATE), intval($pid["pid"])); - else { + } else { // Kill long running processes // Check if the priority is in a valid range @@ -397,9 +397,11 @@ function poller_kill_stale_workers() { dbesc(datetime_convert()), intval(PRIORITY_NEGLIGIBLE), intval($pid["pid"])); - } else + } else { logger("Worker process ".$pid["pid"]." (".implode(" ", $argv).") now runs for ".round($duration)." of ".$max_duration." allowed minutes. That's okay.", LOGGER_DEBUG); + } } + } } /** @@ -558,9 +560,9 @@ function poller_worker_process() { ORDER BY `priority`, `created` LIMIT 1", dbesc(NULL_DATE), intval($highest_priority)); - if (dbm::is_result($r)) + if (dbm::is_result($r)) { return $r; - + } // Give slower processes some processing time $r = q("SELECT * FROM `workerqueue` WHERE `executed` <= '%s' AND `priority` > %d @@ -570,9 +572,9 @@ function poller_worker_process() { } // If there is no result (or we shouldn't pass lower processes) we check without priority limit - if (($highest_priority == 0) OR !dbm::is_result($r)) + if (($highest_priority == 0) OR !dbm::is_result($r)) { $r = q("SELECT * FROM `workerqueue` WHERE `executed` <= '%s' ORDER BY `priority`, `created` LIMIT 1", dbesc(NULL_DATE)); - + } return $r; }