Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-09-23 13:14:31 +0300
committerJoas Schilling <coding@schilljs.com>2020-09-23 13:14:31 +0300
commitb497067ead79d617a09d081f580b1cd930fcb771 (patch)
tree43a14d0130affa45faf43860117c9bb2210631c4 /lib/private/InitialStateService.php
parent74f4dbe9de9dd720c3392c4e5d49cc63a6f6e1d1 (diff)
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.php10
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 = [];