mirror of
https://github.com/nextcloud/server.git
synced 2026-06-18 05:00:03 -04:00
fix(CapabilitiesManager): only check execution time if debug mode is enabled
Signed-off-by: Simon L. <szaimen@e.mail.de> Co-Authored-By: Anna <anna@nextcloud.com>
This commit is contained in:
parent
ec03e87675
commit
3e6d2dc794
1 changed files with 6 additions and 1 deletions
|
|
@ -13,6 +13,7 @@ use OCP\AppFramework\QueryException;
|
|||
use OCP\Capabilities\ICapability;
|
||||
use OCP\Capabilities\IInitialStateExcludedCapability;
|
||||
use OCP\Capabilities\IPublicCapability;
|
||||
use OCP\IConfig;
|
||||
use OCP\ILogger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
|
|
@ -57,11 +58,15 @@ class CapabilitiesManager {
|
|||
// that we would otherwise inject to every page load
|
||||
continue;
|
||||
}
|
||||
|
||||
$startTime = microtime(true);
|
||||
$capabilities = array_replace_recursive($capabilities, $c->getCapabilities());
|
||||
$endTime = microtime(true);
|
||||
|
||||
// Only check execution time if debug mode is enabled
|
||||
$debugMode = \OCP\Server::get(IConfig::class)->getSystemValueBool('debug', false);
|
||||
$timeSpent = $endTime - $startTime;
|
||||
if ($timeSpent > self::ACCEPTABLE_LOADING_TIME) {
|
||||
if ($debugMode && $timeSpent > self::ACCEPTABLE_LOADING_TIME) {
|
||||
$logLevel = match (true) {
|
||||
$timeSpent > self::ACCEPTABLE_LOADING_TIME * 16 => ILogger::FATAL,
|
||||
$timeSpent > self::ACCEPTABLE_LOADING_TIME * 8 => ILogger::ERROR,
|
||||
|
|
|
|||
Loading…
Reference in a new issue