The function to check for maxload and the lockfile is centralized

This commit is contained in:
Michael Vogel 2016-03-08 20:28:09 +01:00
parent ec9c9f0be7
commit beb2346cfc
10 changed files with 66 additions and 172 deletions

View file

@ -57,17 +57,8 @@ function delivery_run(&$argv, &$argc){
continue;
}
$maxsysload = intval(get_config('system','maxloadavg'));
if($maxsysload < 1)
$maxsysload = 50;
$load = current_load();
if($load) {
if(intval($load) > $maxsysload) {
logger('system: load ' . $load . ' too high. Delivery deferred to next queue run.');
return;
}
}
if (App::maxload_reached())
return;
// It's ours to deliver. Remove it from the queue.