diff options
author | Robin Appelman <robin@icewind.nl> | 2025-03-05 18:31:19 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2025-03-19 17:30:36 +0100 |
commit | 4bc87f9b7f16fc5372bb6ea89fe0791a2ad71929 (patch) | |
tree | aebc6a371f34331392ca609a2591f975a490ef06 /lib/private/Files/SetupManager.php | |
parent | a532737e89b6f8533546245b217e67096457b463 (diff) | |
download | nextcloud-server-fetch-mount-memory-30-squash.tar.gz nextcloud-server-fetch-mount-memory-30-squash.zip |
squash: memory optimizationsfetch-mount-memory-30-squash
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 <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/SetupManager.php')
-rw-r--r-- | lib/private/Files/SetupManager.php | 22 |
1 files changed, 12 insertions, 10 deletions
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) { |