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
parent 15542a8690
commit 421acee65b
4 changed files with 28 additions and 1 deletions

View file

@ -51,6 +51,17 @@ function delivery_run($argv, $argc){
return;
}
$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. Delivery deferred to next queue run.');
return;
}
}
// It's ours to deliver. Remove it from the queue.
q("delete from deliverq where cmd = '%s' and item = %d and contact = %d limit 1",