From: Michael Vogel Date: Sat, 2 May 2015 20:05:04 +0000 (+0200) Subject: New page setting for the maximum frontend load value. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=237b5a6e40378df0353ad3954484ed4053b59a96;p=friendica.git New page setting for the maximum frontend load value. --- diff --git a/index.php b/index.php index 31af8868d7..02316e1e95 100644 --- a/index.php +++ b/index.php @@ -53,12 +53,12 @@ if(!$install) { load_config('config'); load_config('system'); - $maxsysload = intval(get_config('system','maxloadavg')); - if($maxsysload < 1) - $maxsysload = 50; + $maxsysload_frontend = intval(get_config('system','maxloadavg_frontend')); + if($maxsysload_frontend < 1) + $maxsysload_frontend = 50; if(function_exists('sys_getloadavg')) { $load = sys_getloadavg(); - if(intval($load[0]) > $maxsysload) { + if(intval($load[0]) > $maxsysload_frontend) { logger('system: load ' . $load[0] . ' too high. Service Temporarily Unavailable.'); header($_SERVER["SERVER_PROTOCOL"].' 503 Service Temporarily Unavailable'); header('Retry-After: 300'); diff --git a/mod/admin.php b/mod/admin.php index 0aa9023738..4383406476 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -357,6 +357,7 @@ function admin_page_site_post(&$a){ $delivery_interval = ((x($_POST,'delivery_interval')) ? intval(trim($_POST['delivery_interval'])) : 0); $poll_interval = ((x($_POST,'poll_interval')) ? intval(trim($_POST['poll_interval'])) : 0); $maxloadavg = ((x($_POST,'maxloadavg')) ? intval(trim($_POST['maxloadavg'])) : 50); + $maxloadavg_frontend = ((x($_POST,'maxloadavg_frontend')) ? intval(trim($_POST['maxloadavg_frontend'])) : 50); $dfrn_only = ((x($_POST,'dfrn_only')) ? True : False); $ostatus_disabled = !((x($_POST,'ostatus_disabled')) ? True : False); $ostatus_poll_interval = ((x($_POST,'ostatus_poll_interval')) ? intval(trim($_POST['ostatus_poll_interval'])) : 0); @@ -423,6 +424,7 @@ function admin_page_site_post(&$a){ set_config('system','delivery_interval',$delivery_interval); set_config('system','poll_interval',$poll_interval); set_config('system','maxloadavg',$maxloadavg); + set_config('system','maxloadavg_frontend',$maxloadavg_frontend); set_config('config','sitename',$sitename); set_config('config','hostname',$hostname); set_config('config','sender_email', $sender_email); @@ -677,6 +679,7 @@ function admin_page_site(&$a) { '$delivery_interval' => array('delivery_interval', t("Delivery interval"), (x(get_config('system','delivery_interval'))?get_config('system','delivery_interval'):2), t("Delay background delivery processes by this many seconds to reduce system load. Recommend: 4-5 for shared hosts, 2-3 for virtual private servers. 0-1 for large dedicated servers.")), '$poll_interval' => array('poll_interval', t("Poll interval"), (x(get_config('system','poll_interval'))?get_config('system','poll_interval'):2), t("Delay background polling processes by this many seconds to reduce system load. If 0, use delivery interval.")), '$maxloadavg' => array('maxloadavg', t("Maximum Load Average"), ((intval(get_config('system','maxloadavg')) > 0)?get_config('system','maxloadavg'):50), t("Maximum system load before delivery and poll processes are deferred - default 50.")), + '$maxloadavg_frontend' => array('maxloadavg_frontend', t("Maximum Load Average (Frontend)"), ((intval(get_config('system','maxloadavg_frontend')) > 0)?get_config('system','maxloadavg_frontend'):50), t("Maximum system load before the frontend quits service - default 50.")), '$use_fulltext_engine' => array('use_fulltext_engine', t("Use MySQL full text engine"), get_config('system','use_fulltext_engine'), t("Activates the full text engine. Speeds up search - but can only search for four and more characters.")), '$suppress_language' => array('suppress_language', t("Suppress Language"), get_config('system','suppress_language'), t("Suppress language information in meta information about a posting.")), diff --git a/view/templates/admin_site.tpl b/view/templates/admin_site.tpl index 6880f0fd91..bcaed585c2 100644 --- a/view/templates/admin_site.tpl +++ b/view/templates/admin_site.tpl @@ -107,6 +107,7 @@ {{include file="field_input.tpl" field=$delivery_interval}} {{include file="field_input.tpl" field=$poll_interval}} {{include file="field_input.tpl" field=$maxloadavg}} + {{include file="field_input.tpl" field=$maxloadavg_frontend}} {{include file="field_input.tpl" field=$abandon_days}} {{include file="field_input.tpl" field=$lockpath}} {{include file="field_input.tpl" field=$temppath}}