1
0
Fork 0

implement max load average before queuing/deferring delivery and poller processes

This commit is contained in:
friendica 2012-05-03 21:50:48 -07:00
commit 421acee65b
4 changed files with 28 additions and 1 deletions

View file

@ -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();