Cache the merged media catalog and trim card rendering

This commit is contained in:
Fisto
2026-09-21 10:52:18 +02:00
parent 41732bd96f
commit 6761a2192e
5 changed files with 116 additions and 5 deletions
+11
View File
@@ -190,6 +190,17 @@ Previews run after every walk:
of 25 with a 60 s cooldown between them, because bursts of thumbnail fetches trigger Discord and
provider rate limits. A batch counts rows, not successes.
## Browsing performance
Every grid request used to rescan every scrape database to merge URLs. `MediaService` now keeps a
short-lived candidate cache: the key is a revision of the scrape metadata (id, state, update time,
preview count) plus the normalized filter shape — page limits, offsets, and empty values are
dropped, so every page of one filter set shares a single scan and later pages return in
milliseconds. The 15 s TTL and the revision key cover new pages, finished scrapes, and freshly
cached previews. The client only refetches stats when the filters change (or after a minute), and
grid cards use lazy async decoding with CSS `content-visibility` so a long stream does not pay
layout and paint for off-screen tiles.
## Rate limits
Discord and the provider APIs throttle bursts. The engine detects limiting and holds all media