From 4bc87f9b7f16fc5372bb6ea89fe0791a2ad71929 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 5 Mar 2025 18:31:19 +0100 Subject: squash: memory optimizations fix: optimize FileUtils::getFilesByUser fix: fix getNodeFromCacheEntryAndMount using relative path fix: reduce memory usage for fetching cached mount into fix: improve getMountsForFileId memory usage and performance fix: fix "new mount" false positives fix: skip registering mounts if there are no new mount providers fix: fix oci string length with empty strings Signed-off-by: Robin Appelman --- lib/private/Files/SetupManager.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'lib/private/Files/SetupManager.php') diff --git a/lib/private/Files/SetupManager.php b/lib/private/Files/SetupManager.php index 4d1e379ea58..51b68d06166 100644 --- a/lib/private/Files/SetupManager.php +++ b/lib/private/Files/SetupManager.php @@ -271,18 +271,20 @@ class SetupManager { private function afterUserFullySetup(IUser $user, array $previouslySetupProviders): void { $this->eventLogger->start('fs:setup:user:full:post', 'Housekeeping after user is setup'); $userRoot = '/' . $user->getUID() . '/'; - $mounts = $this->mountManager->getAll(); - $mounts = array_filter($mounts, function (IMountPoint $mount) use ($userRoot) { - return str_starts_with($mount->getMountPoint(), $userRoot); - }); - $allProviders = array_map(function (IMountProvider $provider) { + $allProviders = array_map(function ($provider) { return get_class($provider); - }, $this->mountProviderCollection->getProviders()); + }, array_merge($this->mountProviderCollection->getProviders(), $this->mountProviderCollection->getHomeProviders())); $newProviders = array_diff($allProviders, $previouslySetupProviders); - $mounts = array_filter($mounts, function (IMountPoint $mount) use ($previouslySetupProviders) { - return !in_array($mount->getMountProvider(), $previouslySetupProviders); - }); - $this->userMountCache->registerMounts($user, $mounts, $newProviders); + if (count($newProviders) > 0) { + $mounts = $this->mountManager->getAll(); + $mounts = array_filter($mounts, function (IMountPoint $mount) use ($userRoot, $previouslySetupProviders) { + if (!str_starts_with($mount->getMountPoint(), $userRoot)) { + return false; + } + return !in_array($mount->getMountProvider(), $previouslySetupProviders); + }); + $this->userMountCache->registerMounts($user, $mounts, $newProviders); + } $cacheDuration = $this->config->getSystemValueInt('fs_mount_cache_duration', 5 * 60); if ($cacheDuration > 0) { -- cgit v1.2.3