Repository navigation
Don't hold the window for a game database rebuild - #102
Merged
Merged
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.