Sometimes the function "sys_getloadavg" doesn't return an array. This is a workaround.

This commit is contained in:
Michael Vogel 2015-12-15 23:26:58 +01:00
parent 791d152b8f
commit 6e03477598
7 changed files with 43 additions and 27 deletions

View file

@ -27,10 +27,11 @@ function cronhooks_run(&$argv, &$argc){
$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[0] . ' too high. Cronhooks deferred to next scheduled run.');
$load = current_load();
if($load) {
if(intval($load) > $maxsysload) {
logger('system: load ' . $load . ' too high. Cronhooks deferred to next scheduled run.');
return;
}
}