Skip to content

Commit a1979c9

Browse files
committed
perf(dav): Avoid getting DB Connection inside callback
Fetch it once outside instead and pass it to the callback. Signed-off-by: Carl Schwan <carlschwan@kde.org>
1 parent 408f9e8 commit a1979c9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

apps/dav/lib/Connector/Sabre/Server.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,13 @@ private function getMonitoredCallback(
150150
string $pluginName,
151151
string $eventName,
152152
): callable {
153+
$connection = \OCP\Server::get(Connection::class);
153154
return function (PropFind $propFind, INode $node) use (
154155
$callBack,
155156
$pluginName,
156157
$eventName,
158+
$connection,
157159
): bool {
158-
$connection = \OCP\Server::get(Connection::class);
159160
$queriesBefore = $connection->getStats()['executed'];
160161
$result = $callBack($propFind, $node);
161162
$queriesAfter = $connection->getStats()['executed'];

0 commit comments

Comments
 (0)