mirror of
https://github.com/friendica/friendica
synced 2025-04-26 19:10:11 +00:00
Remove 'maxloadavg_frontend' restriction in Friendica
This commit is contained in:
parent
c2b5eb2838
commit
62bacbb833
6 changed files with 5 additions and 37 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue