mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
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>
This commit is contained in:
parent
c1e362b167
commit
f9fa9fb625
1 changed files with 2 additions and 1 deletions
|
|
@ -150,12 +150,13 @@ class Server extends \Sabre\DAV\Server {
|
|||
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'];
|
||||
|
|
|
|||
Loading…
Reference in a new issue