diff options
author | Joas Schilling <coding@schilljs.com> | 2020-09-23 12:14:31 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-09-23 12:14:31 +0200 |
commit | b497067ead79d617a09d081f580b1cd930fcb771 (patch) | |
tree | 43a14d0130affa45faf43860117c9bb2210631c4 /lib/private/InitialStateService.php | |
parent | 74f4dbe9de9dd720c3392c4e5d49cc63a6f6e1d1 (diff) | |
download | nextcloud-server-b497067ead79d617a09d081f580b1cd930fcb771.tar.gz nextcloud-server-b497067ead79d617a09d081f580b1cd930fcb771.zip |
Log a warning if a "lazy" initial state loads longer than 1 second
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/InitialStateService.php')
-rw-r--r-- | lib/private/InitialStateService.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/private/InitialStateService.php b/lib/private/InitialStateService.php index 55ce9c41726..c74eb683bd9 100644 --- a/lib/private/InitialStateService.php +++ b/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 = []; |