From a1979c9cd10192c9aabc95e5c2952254c61755f9 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Tue, 13 Jan 2026 11:47:11 +0100 Subject: [PATCH] perf(dav): Avoid getting DB Connection inside callback Fetch it once outside instead and pass it to the callback. Signed-off-by: Carl Schwan --- apps/dav/lib/Connector/Sabre/Server.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/dav/lib/Connector/Sabre/Server.php b/apps/dav/lib/Connector/Sabre/Server.php index 477f9b93a4dce..c6e55c79af25b 100644 --- a/apps/dav/lib/Connector/Sabre/Server.php +++ b/apps/dav/lib/Connector/Sabre/Server.php @@ -150,12 +150,13 @@ private function getMonitoredCallback( string $pluginName, string $eventName, ): callable { + $connection = \OCP\Server::get(Connection::class); return function (PropFind $propFind, INode $node) use ( $callBack, $pluginName, $eventName, + $connection, ): bool { - $connection = \OCP\Server::get(Connection::class); $queriesBefore = $connection->getStats()['executed']; $result = $callBack($propFind, $node); $queriesAfter = $connection->getStats()['executed'];