Files
romm/backend/tests/handler/database
kynrek f9c8c8ab2a perf(roms): page grouped galleries from the cached id index (#5636)
* perf(roms): page grouped galleries from the cached id index

With group_by_meta_id, every gallery page ran the sibling-dedup window
over the whole library, because the frontend fetches pages with
with_rom_id_index=false. Grouped pages for the whole library or a plain
platform list now slice the versioned, cached id index instead, so only
the first page after a change pays for the window. Filtered, searched and
collection pages still run live.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q367p1Ri2c1dKeYCpQgHeh

* fix(roms): share one cached key for grouped platform sidecars (pr-ready: code-review)

Grouped platform-only sets read their char index, id index and pages
from one key, deleting a platform invalidates the cached lists, and the
platform-only gate derives from has_scope().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(roms): simplify grouped sidecar caching (pr-ready: simplify)

Add RomFilterParams.has_only_platform_scope, share one str key base
between the sidecar key builders, collapse the total and index
branches, and dedupe the platform-key tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(roms): cover has_only_platform_scope (pr-ready: review-polish)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(roms): page grouped galleries from a Redis list, bump on deletes

- Store the cached id index as a Redis list. A grouped page reads its
  window with LRANGE/LLEN instead of decoding the whole list.
- Page requests only read the cache; on a miss they run the live page
  query, so only the index request rebuilds the list.
- Cache grouped platform sets only for a single platform, and never
  store an empty list, so client-chosen platform ids can't grow Redis.
- delete_rom and delete_platform queue the after-commit version bump,
  replacing the hand-placed calls in the endpoints and cleanup task.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
2026-11-18 18:48:02 -05:00
..
2025-10-23 11:12:17 -04:00