From 36608f71a3015920f492a308db21fb13a766ee46 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Wed, 4 Feb 2026 09:10:30 +0100 Subject: [PATCH] perf(FsEventService): Avoid fetching nodes Signed-off-by: Marcel Klehr --- lib/Service/FsEventService.php | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/lib/Service/FsEventService.php b/lib/Service/FsEventService.php index d675b22..58adb0f 100644 --- a/lib/Service/FsEventService.php +++ b/lib/Service/FsEventService.php @@ -11,7 +11,6 @@ use OCA\ContextChat\Db\QueueFile; use OCA\ContextChat\Logger; use OCP\DB\Exception; -use OCP\Files\File; use OCP\Files\Folder; use OCP\Files\InvalidPathException; use OCP\Files\IRootFolder; @@ -117,27 +116,13 @@ public function onInsert(Node $node, bool $recurse = true, bool $update = false) } foreach ($fileIds as $fileId) { - $file = current($this->rootFolder->getById($fileId)); - if (!$file instanceof File) { - continue; - } - if (!$this->allowedPath($file)) { - continue; - } $queueFile = new QueueFile(); - if ($file->getMountPoint()->getNumericStorageId() === null) { + if ($node->getMountPoint()->getNumericStorageId() === null) { return; } - $queueFile->setStorageId($file->getMountPoint()->getNumericStorageId()); - $queueFile->setRootId($file->getMountPoint()->getStorageRootId()); - - try { - $queueFile->setFileId($file->getId()); - } catch (InvalidPathException|NotFoundException $e) { - $this->logger->warning($e->getMessage(), ['exception' => $e]); - return; - } - + $queueFile->setStorageId($node->getMountPoint()->getNumericStorageId()); + $queueFile->setRootId($node->getMountPoint()->getStorageRootId()); + $queueFile->setFileId($fileId); $queueFile->setUpdate($update); try { $this->queue->insertIntoQueue($queueFile);