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

perf(files_reminders): Reduce db queries on propfind #50244

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Pytal
Copy link
Member

@Pytal Pytal commented Jan 17, 2025

Summary

  • Add caching for reminders
  • Reduces database queries by n number of nodes in the directory per PROPFIND

Checklist

@Pytal Pytal added this to the Nextcloud 31 milestone Jan 17, 2025
@Pytal Pytal requested a review from icewind1991 January 17, 2025 23:07
@Pytal Pytal self-assigned this Jan 17, 2025
@icewind1991
Copy link
Member

Doing n cache lookups per propfind isn't great either. Is it possible to change the logic so all reminders in a folder can be looked up at once?

@Pytal
Copy link
Member Author

Pytal commented Jan 20, 2025

Doing n cache lookups per propfind isn't great either. Is it possible to change the logic so all reminders in a folder can be looked up at once?

Any pointers for how this could be done?

@icewind1991
Copy link
Member

In the propfind plugin, you can detect when the property is being requested as part of the propfind for a folder and contents. Then pre-load the data for the entire folder, keeping it in memory for use when the properties are requested for the individual files.

See for example:

if ($node instanceof Directory
&& $propFind->getDepth() !== 0
&& !is_null($propFind->getStatus(self::PROPERTY_NAME_UNREAD))
) {
$this->cacheDirectory($node);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants