Skip to content

Don't hold the window for a game database rebuild - #102

Merged
Omar-VF merged 2 commits into
dev-publicfrom
fix/startup-index-wait
Oct 19, 2026
Merged

Omar-VF merged 2 commits into
dev-publicfrom
fix/startup-index-wait

Conversation

@Omar-VF

@Omar-VF Omar-VF commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

Since #84, OpenSave reads the game database while it starts, to know which files in each save folder are settings. When the database was due a rebuild, the start waited for it. That rebuild parses the whole manifest, about a minute, with the window stuck on "Starting OpenSave…". It is due on the first start after an update that changes the index format, so every user moving to the next release would hit it, and again after each weekly manifest download.

At start, OpenSave now uses the index already on disk, even if it is out of date, or the built-in one when there is none. It rebuilds in the background, and the new index is read at the next start. That is already when a database update takes effect for device settings. Until then, a settings file the old index doesn't name is synced, which is the safe direction.

Scans and the other lookups still wait for a fresh index, as before.

Tests: internal/presets/index_nowait_test.go (an out-of-date index is used straight away and rebuilt behind it; with no index, nothing waits and one gets built). Tried by hand: the start after a manifest update went from about a minute to immediate.

Since device settings (#84) the daemon reads the game database while it
starts, to know which files in each save folder are settings. When the
database is due a rebuild it waited for it: a parse of the whole
manifest, about a minute, with the window on "Starting OpenSave..." the
whole time. The rebuild is due at the first start after an update that
changes the index format (every user moving to this release) and after
each weekly manifest download.

At start it now takes the index on disk as it is, stale or not, or the
embedded one when there is none, and rebuilds in the background. The
new index is read at the next start, which is already when a database
update takes effect for device settings. Until then a settings file the
old index does not name is synced, the safe direction.

Scans and the other lookups still wait for a fresh index, as before.
@vercel

vercel Bot commented Oct 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
open-save Ready Ready Preview Oct 19, 2026 1:42pm UTC

Linux CI's coarse file timestamps gave the rebuilt index the same time as
the manifest written moments before it, so it never counted as newer.
@Omar-VF
Omar-VF merged commit 6eba3c0 into dev-public Oct 19, 2026
20 checks passed
@Omar-VF
Omar-VF deleted the fix/startup-index-wait branch October 19, 2026 15:19
Omar-VF added a commit that referenced this pull request Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant