From 4d0a695588f0d68e1d838d69855a50b983b53f90 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 28 Dec 2024 16:30:33 +0000 Subject: [PATCH] use $dice_profiler_threshold in Router not as property --- src/App/Router.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/App/Router.php b/src/App/Router.php index c0ec7b1e1e..f1f0510867 100644 --- a/src/App/Router.php +++ b/src/App/Router.php @@ -89,9 +89,6 @@ class Router /** @var bool */ private $isLocalUser; - /** @var float */ - private $dice_profiler_threshold; - /** @var string */ private $baseRoutesFilepath; @@ -124,7 +121,6 @@ class Router $this->server = $server; $this->logger = $logger; $this->isLocalUser = !empty($userSession->getLocalUserId()); - $this->dice_profiler_threshold = $config->get('system', 'dice_profiler_threshold', 0); $this->routeCollector = $routeCollector ?? new RouteCollector(new Std(), new GroupCountBased()); @@ -327,14 +323,16 @@ class Router { $moduleClass = $module_class ?? $this->getModuleClass(); + $dice_profiler_threshold = $this->config->get('system', 'dice_profiler_threshold', 0); + $stamp = microtime(true); /** @var ICanHandleRequests $module */ $module = $dice->create($moduleClass, $this->parameters); - if ($this->dice_profiler_threshold > 0) { + if ($dice_profiler_threshold > 0) { $dur = floatval(microtime(true) - $stamp); - if ($dur >= $this->dice_profiler_threshold) { + if ($dur >= $dice_profiler_threshold) { $this->logger->notice('Dice module creation lasts too long.', ['duration' => round($dur, 3), 'module' => $moduleClass, 'parameters' => $this->parameters]); } }