Files
romm/backend/handler
Sam Dornan b1c0dacb9f perf(scan): scope a rom-id scan to the selected roms
A scan with `roms_ids` set only narrowed which roms get metadata, not the
work around them: it still listed the platform folder, re-resolved the
platform's metadata, re-hashed every firmware file, synced the whole
platform's missing-file state twice, and walked every other rom in batches
to mark it present. Rescanning one file therefore cost time proportional to
the platform, not to the file.

Resolve a scoped scan's work from the database instead, via a new
`_scan_selected_roms` that skips all of the platform-wide reconciliation.
The gamelist cache warm-up stays, since hash matching reads from it.

`refresh_smart_collections` was likewise recomputing every smart collection
across the whole library after any scan; a scoped one now uses the targeted
`refresh_smart_collections_for_roms`.

A library scan never reaches an entry whose file is gone, since it walks the
filesystem. A database-driven one does, and scanning marks a rom present
unconditionally, so the scoped path checks the path first and marks it
missing rather than resurrecting it. That check needs `directory_exists`
alongside `file_exists`, which also derives `flat`/`nested` for the `FSRom`
a library scan gets from splitting its listing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-11 15:01:00 -05:00
..
2025-12-07 12:19:13 -05:00