Browse Source
Log a warning if a "lazy" initial state loads longer than 1 second
Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/23015/head
Joas Schilling
5 years ago
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
1 changed files with
10 additions and
0 deletions
-
lib/private/InitialStateService.php
|
|
|
@ -72,7 +72,17 @@ class InitialStateService implements IInitialStateService { |
|
|
|
private function invokeLazyStateCallbacks(): void { |
|
|
|
foreach ($this->lazyStates as $app => $lazyStates) { |
|
|
|
foreach ($lazyStates as $key => $lazyState) { |
|
|
|
$startTime = microtime(true); |
|
|
|
$this->provideInitialState($app, $key, $lazyState()); |
|
|
|
$endTime = microtime(true); |
|
|
|
$duration = $endTime - $startTime; |
|
|
|
if ($duration > 1) { |
|
|
|
$this->logger->warning('Lazy initial state provider for {key} took {duration} seconds.', [ |
|
|
|
'app' => $app, |
|
|
|
'key' => $key, |
|
|
|
'duration' => round($duration, 2), |
|
|
|
]); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
$this->lazyStates = []; |
|
|
|
|