Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add event to register mount providers more lazy #45953

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

juliushaertl
Copy link
Member

@juliushaertl juliushaertl commented Jun 18, 2024

Mount provider registration currently requires to obtain the MountProviderCollection and create instances of apps mount providers, which might pull in more heavy dependencies. While this is not a problem in files_sharing, other apps like circles or collectives have a larger tree of dependencies that the mount provider class is pulling in.

We don't need the mount providers always available so we can save those DI setup times for all requests that don't access the mount provider list through accessing the storage.

Checklist

@juliushaertl juliushaertl force-pushed the chore/lazy-mount-providers branch 6 times, most recently from f2d0c53 to 9f2cdeb Compare June 18, 2024 14:54
@solracsf solracsf added this to the Nextcloud 30 milestone Jun 18, 2024
Copy link
Contributor

@come-nc come-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An other solution would be to register provider classes and let the mountprovidercollection get them from DI when needed?

Only problem is if an app want to register instances with parameters in the constructor, or even several instances of the same class with different config. In this situation your solution works better.

@@ -230,12 +216,17 @@ public function getRootMounts(): array {
}

public function clearProviders() {
$this->$this->registerEventEmitted = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$this->$this->registerEventEmitted = false;
$this->registerEventEmitted = false;

I suppose?

Signed-off-by: Julius Härtl <jus@bitgrid.net>
@juliushaertl juliushaertl self-assigned this Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

None yet

5 participants