X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fpoller.php;h=7ffd47aa68e653635f5460dbaa6ff454dfbdeb9f;hb=146dc5c8cd75dd34b5d0e0f1f214927cdd10ea4b;hp=90e94ede9e05af23ba0bd56791569bbc6e0e1125;hpb=4ee15cc682d0d89dffac7b26ab5ca79894bb73d8;p=friendica.git diff --git a/include/poller.php b/include/poller.php index 90e94ede9e..7ffd47aa68 100644 --- a/include/poller.php +++ b/include/poller.php @@ -29,17 +29,8 @@ function poller_run(&$argv, &$argc){ if (poller_max_connections_reached()) return; - $load = current_load(); - if($load) { - $maxsysload = intval(get_config('system','maxloadavg')); - if($maxsysload < 1) - $maxsysload = 50; - - if(intval($load) > $maxsysload) { - logger('system: load ' . $load . ' too high. poller deferred to next scheduled run.'); - return; - } - } + if (App::maxload_reached()) + return; // Checking the number of workers if (poller_too_much_workers(1)) { @@ -205,6 +196,12 @@ function poller_max_connections_reached() { */ function poller_kill_stale_workers() { $r = q("SELECT `pid`, `executed` FROM `workerqueue` WHERE `executed` != '0000-00-00 00:00:00'"); + + if (!is_array($r) || count($r) == 0) { + // No processing here needed + return; + } + foreach($r AS $pid) if (!posix_kill($pid["pid"], 0)) q("UPDATE `workerqueue` SET `executed` = '0000-00-00 00:00:00', `pid` = 0 WHERE `pid` = %d",