]> git.mxchange.org Git - friendica.git/commitdiff
The system's load is now checked, when the cronhooks are started.
authorMichael Vogel <icarus@dabo.de>
Fri, 4 Apr 2014 08:48:02 +0000 (10:48 +0200)
committerMichael Vogel <icarus@dabo.de>
Fri, 4 Apr 2014 08:48:02 +0000 (10:48 +0200)
include/cronhooks.php

index 15d49fe5474b32101c60ff5ba90b58c383f1ac39..cf1d13765faf56d8d55b49bc5d6796cc677ede02 100644 (file)
@@ -9,7 +9,7 @@ function cronhooks_run(&$argv, &$argc){
        if(is_null($a)) {
                $a = new App;
        }
-  
+
        if(is_null($db)) {
            @include(".htconfig.php");
        require_once("include/dba.php");
@@ -24,6 +24,17 @@ function cronhooks_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, 'cron.lck');
@@ -38,7 +49,7 @@ function cronhooks_run(&$argv, &$argc){
        load_hooks();
 
        logger('cronhooks: start');
-       
+
 
        $d = datetime_convert();