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

use lazy user in UserMountCache for getting user for cached mount instead of duplicating logic #43437

Merged
merged 3 commits into from
Mar 6, 2024

Conversation

icewind1991
Copy link
Member

@icewind1991 icewind1991 commented Feb 7, 2024

remove some duplication and hopefully make it clearer what the logic is doing

@icewind1991 icewind1991 force-pushed the cleanup-mount-by-id-duplication branch from 0d967eb to 5125c00 Compare February 9, 2024 09:44
@icewind1991 icewind1991 added the 3. to review Waiting for reviews label Feb 9, 2024
@icewind1991 icewind1991 requested review from juliushaertl, Altahrim, a team, ArtificialOwl and Fenn-CS and removed request for a team February 9, 2024 09:45
@icewind1991 icewind1991 added this to the Nextcloud 29 milestone Feb 9, 2024
@icewind1991 icewind1991 marked this pull request as ready for review February 9, 2024 09:45
@icewind1991 icewind1991 force-pushed the cleanup-mount-by-id-duplication branch from 5125c00 to 3ca220d Compare February 9, 2024 10:34
@icewind1991 icewind1991 force-pushed the cleanup-mount-by-id-duplication branch from 3ca220d to d3a7d6a Compare March 5, 2024 10:18
@icewind1991 icewind1991 force-pushed the cleanup-mount-by-id-duplication branch from d3a7d6a to 51019fd Compare March 6, 2024 09:54
return null;
}
private function dbRowToMountInfo(array $row, ?callable $pathCallback = null): ICachedMountInfo {
$user = new LazyUser($row['user_id'], $this->userManager);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add a comment explaining the hack?
This is to prevent fetching the full user multiple times?

Copy link
Member Author

Choose a reason for hiding this comment

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

fetching multiple times is not the issue (it's cached), it not having to fetch the user details when nobody is asking for it.

It's the same as with any other use of LazyUser so a comment would be redundant imo

@skjnldsv skjnldsv merged commit dfae067 into master Mar 6, 2024
160 checks passed
@skjnldsv skjnldsv deleted the cleanup-mount-by-id-duplication branch March 6, 2024 17:57
@blizzz blizzz mentioned this pull request Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants