Skip to content

Commit 5acb93a

Browse files
authored
Merge pull request nextcloud#57510 from nextcloud/carl/callback-optimization
perf(dav): Avoid getting DB Connection inside callback
2 parents 048037b + a1979c9 commit 5acb93a

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)