Remove 'maxloadavg_frontend' restriction in Friendica

This commit is contained in:
Philipp 2021-11-01 13:54:54 +01:00
parent c2b5eb2838
commit 62bacbb833
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
6 changed files with 5 additions and 37 deletions

View file

@ -42,11 +42,6 @@ class System
*/
private $logger;
/**
* @var App\Mode
*/
private $mode;
/**
* @var IManageConfigValues
*/
@ -57,10 +52,9 @@ class System
*/
private $basePath;
public function __construct(LoggerInterface $logger, App\Mode $mode, IManageConfigValues $config, string $basepath)
public function __construct(LoggerInterface $logger, IManageConfigValues $config, string $basepath)
{
$this->logger = $logger;
$this->mode = $mode;
$this->config = $config;
$this->basePath = $basepath;
}
@ -156,24 +150,15 @@ class System
*/
public function isMaxLoadReached(): bool
{
if ($this->mode->isBackend()) {
$process = 'backend';
$maxsysload = intval($this->config->get('system', 'maxloadavg'));
if ($maxsysload < 1) {
$maxsysload = 50;
}
} else {
$process = 'frontend';
$maxsysload = intval($this->config->get('system', 'maxloadavg_frontend'));
if ($maxsysload < 1) {
$maxsysload = 50;
}
$maxsysload = intval($this->config->get('system', 'maxloadavg'));
if ($maxsysload < 1) {
$maxsysload = 50;
}
$load = System::currentLoad();
if ($load) {
if (intval($load) > $maxsysload) {
$this->logger->warning('system load for process too high.', ['load' => $load, 'process' => $process, 'maxsysload' => $maxsysload]);
$this->logger->warning('system load for process too high.', ['load' => $load, 'process' => 'backend', 'maxsysload' => $maxsysload]);
return true;
}
}