Configurable amount of maximum processes

This commit is contained in:
Michael Vogel 2016-06-04 11:04:26 +02:00
parent 140225b1a8
commit b45772ba6e
3 changed files with 36 additions and 16 deletions

View file

@ -45,7 +45,7 @@ require_once("include/dbm.php");
if(!$install) {
$db = new dba($db_host, $db_user, $db_pass, $db_data, $install);
unset($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
/**
* Load configs from db. Overwrite configs from .htconfig.php
@ -56,12 +56,17 @@ if(!$install) {
$processlist = dbm::processlist();
if ($processlist["list"] != "") {
logger("Processes: ".$processlist["amount"]." - Processlist: ".$processlist["list"], LOGGER_DEBUG);
// More than 20 running database processes?
// The system is too busy, so quit.
if ($processlist["amount"] > 20)
system_unavailable();
logger("Processcheck: Processes: ".$processlist["amount"]." - Processlist: ".$processlist["list"], LOGGER_DEBUG);
$max_processes = get_config('system', 'max_processes_frontend');
if (intval($max_processes) == 0)
$max_processes = 20;
if ($processlist["amount"] > $max_processes) {
logger("Processcheck: Maximum number of processes for frontend tasks (".$max_processes.") reached.", LOGGER_DEBUG);
return;
}
}
$maxsysload_frontend = intval(get_config('system','maxloadavg_frontend'));
@ -453,9 +458,9 @@ if($a->is_mobile || $a->is_tablet) {
$link = 'toggle_mobile?off=1&address=' . curPageURL();
}
$a->page['footer'] = replace_macros(get_markup_template("toggle_mobile_footer.tpl"), array(
'$toggle_link' => $link,
'$toggle_text' => t('toggle mobile')
));
'$toggle_link' => $link,
'$toggle_text' => t('toggle mobile')
));
}
/**