summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-09-23 12:14:01 +0200
committerJoas Schilling <coding@schilljs.com>2020-09-23 12:14:01 +0200
commit74f4dbe9de9dd720c3392c4e5d49cc63a6f6e1d1 (patch)
treebe7be5901b920a9d3f7d0786c572e04e9ddb1d9d /lib/private
parent7d0602792280f88af6867db0131d1bf8984b2c2c (diff)
downloadnextcloud-server-74f4dbe9de9dd720c3392c4e5d49cc63a6f6e1d1.tar.gz
nextcloud-server-74f4dbe9de9dd720c3392c4e5d49cc63a6f6e1d1.zip
Log an error if a dashboard widget loads longer than 1 second
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Dashboard/Manager.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/private/Dashboard/Manager.php b/lib/private/Dashboard/Manager.php
index bc57326dff0..94b80a3b4a4 100644
--- a/lib/private/Dashboard/Manager.php
+++ b/lib/private/Dashboard/Manager.php
@@ -95,7 +95,16 @@ class Manager implements IManager {
}
try {
+ $startTime = microtime(true);
$widget->load();
+ $endTime = microtime(true);
+ $duration = $endTime - $startTime;
+ if ($duration > 1) {
+ \OC::$server->getLogger()->error('Dashboard widget {widget} took {duration} seconds to load.', [
+ 'widget' => $widget->getId(),
+ 'duration' => round($duration, 2),
+ ]);
+ }
} catch (Throwable $e) {
\OC::$server->getLogger()->logException($e, [
'message' => 'Error during dashboard widget loading: ' . $e->getMessage(),