Skip to content

fix(files_reminders): keep folder preload for folders over 512 entries - #64706

Open
skjnldsv wants to merge 1 commit into
masterfrom
fix/files-reminders-large-folders
Open

skjnldsv wants to merge 1 commit into
masterfrom
fix/files-reminders-large-folders

Conversation

@skjnldsv

Copy link
Copy Markdown
Member

Summary

Listing a folder with 512 or more entries runs one oc_files_reminders query per file. #50244 preloads a folder's reminders into createInMemory(), which is a CappedMemoryCache of 512 entries, so large folders evict the preload before the nc:reminder-due-date handler reads it.

The preload now lives in its own per-request map. Every write still goes to the capped cache and clears the preloaded entry, so a reminder created, updated or deleted later in the same request wins. The capped cache stays for per-file lookups to keep memory bounded in background jobs.

Measured on a local instance (SQLite, APCu, Redis), Depth 1 PROPFIND with the props the Files app requests, interleaved runs:

Entries master this PR
512 225 ms, 557 queries 123 ms, 44 queries
1,000 401 ms 202 ms
10,000 3,792 ms, 10,128 queries 1,812 ms, 76 queries
101 60 ms 60 ms

Responses are byte-identical to master for 22,815 entries across 18 PROPFIND and SEARCH requests, including folders with reminders. On MySQL or Postgres each saved query is also a network round trip, so the gain should be larger there.

TODO

  • Backport to affected stable branches (the preload exists since stable31)

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

👾 This pull request was assisted by Claude Code, commits carry an Assisted-by trailer.

@skjnldsv

Copy link
Copy Markdown
Member Author

/backport to stable35

@skjnldsv

Copy link
Copy Markdown
Member Author

/backport to stable34

@skjnldsv

Copy link
Copy Markdown
Member Author

/backport to stable33

@skjnldsv
skjnldsv force-pushed the fix/files-reminders-large-folders branch from a54731b to 8c86d5a Compare September 24, 2026 01:09
ReminderService::cacheFolder() stored one entry per child in the in-memory
cache, which is capped at 512 entries. Listing a folder with 512 or more
children evicted entries before the DAV plugin read them, so each evicted
file fell back to its own query.

Keep the folder preload in a separate per-request map and drop the entry
whenever a reminder is written, so later changes in the same request win.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: John Molakvoæ <14975046+skjnldsv@users.noreply.github.com>
@skjnldsv
skjnldsv force-pushed the fix/files-reminders-large-folders branch from 8c86d5a to b3aa746 Compare September 24, 2026 12:28

This branch has not been deployed

No deployments
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.

1 participant