X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fpoller.php;h=fefc9b381d4a6c18d74cdb20eff26b57aaa42a38;hb=f9a40ccbdea69fc7ffcbdc87356d535c67371210;hp=0a0e66b865ec0445131a9301e1e064e3e16ff496;hpb=c661dc502f1ab4a6361faea1271d3c9a4aafa4ba;p=friendica.git diff --git a/include/poller.php b/include/poller.php index 0a0e66b865..fefc9b381d 100644 --- a/include/poller.php +++ b/include/poller.php @@ -30,6 +30,17 @@ function poller_run($argv, $argc){ load_config('config'); load_config('system'); + $maxsysload = intval(get_config('system','maxloadavg')); + if($maxsysload < 1) + $maxsysload = 50; + if(function_exists('sys_getloadavg')) { + $load = sys_getloadavg(); + if(intval($load[0]) > $maxsysload) { + logger('system: load ' . $load . ' too high. Poller deferred to next scheduled run.'); + return; + } + } + $lockpath = get_config('system','lockpath'); if ($lockpath != '') { $pidfile = new pidfile($lockpath, 'poller.lck'); @@ -39,6 +50,8 @@ function poller_run($argv, $argc){ } } + + $a->set_baseurl(get_config('system','url')); load_hooks(); @@ -113,7 +126,9 @@ function poller_run($argv, $argc){ $force = true; } - $interval = ((get_config('system','delivery_interval') === false) ? 3 : intval(get_config('system','delivery_interval'))); + $interval = intval(get_config('system','poll_interval')); + if(! $interval) + $interval = ((get_config('system','delivery_interval') === false) ? 3 : intval(get_config('system','delivery_interval'))); $sql_extra = (($manual_id) ? " AND `id` = $manual_id " : ""); @@ -186,8 +201,8 @@ function poller_run($argv, $argc){ if($contact['subhub']) { - $interval = get_config('system','pushpoll_frequency'); - $contact['priority'] = (($interval !== false) ? intval($interval) : 3); + $poll_interval = get_config('system','pushpoll_frequency'); + $contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3); $hub_update = false; if((datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")) || $force)