Skip to content

Device settings take the catalogue once it is indexed, without a restart - #133

Open
sivadaboi wants to merge 1 commit into
dev-publicfrom
fix/device-settings-refresh
Open

sivadaboi wants to merge 1 commit into
dev-publicfrom
fix/device-settings-refresh

Conversation

@sivadaboi

@sivadaboi sivadaboi commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

On top of #102. Since #102, device settings read the game database once per run, at start, without waiting for a rebuild, and a database update takes effect at the next start. That holds up after a weekly update, but not on a fresh install.

The problem. On a fresh install there is no downloaded catalogue yet at the first start, so the database read is the one built into the app. None of its 50,910 games has a settings entry (no c field in embedded/ludusavi-index.json.gz). So device settings stay off for the whole first run. Graphics and other settings files sync between devices until OpenSave happens to be restarted, which on a PC that sleeps rather than shuts down can be days.

Seen by hand. Two fresh scratch devices built from dev-public, both of which had played Balatro, each with its own settings.jkr. Balatro was tracked right after install, as people do, and the devices were paired once both downloads were indexed (plus a minute). The first sync was "both sides modified": the Deck opened on a save conflict whose only difference was its graphics file, and the save itself never arrived. Balatro's Configuration tab lists no device settings. With this change, the same steps sync the save, each device keeps its own settings.jkr, and Configuration lists it.

The change:

  • presets.CatalogueGeneration() moves each time a new index is put in place: by a rebuild, or by the index built with the weekly download.
  • The daemon's existing minute ticker (the one that runs ResyncWatchers) compares it with the generation it last read. When it has moved, the ticker:
    • reads the database again, outside the lock, and swaps it in, so settings are never empty in between;
    • runs adoptExclusionView over the games, as at start, so the watcher doesn't take the new view for a change.
  • Start is untouched: it still never waits for a rebuild.

This sits in its own file, daemon/devicesettings_refresh.go, plus one line in the ticker and a field next to devMu, so that it doesn't touch the lines #118/#127/#128 rewrite. The reset sets loaded, db and patterns and leaves any other field zero, which works with today's devSettingsCache and with theirs (their verdicts map is created lazily).

Tests:

  • daemon/devicesettings_refresh_test.go: a game's settings file is synced before the catalogue is indexed, and left out after one tick once it is, with the last snapshot's hash carried over. It fails without the refresh, without the generation bump on rebuild, and without the carry-over.
  • presets/catalogue_generation_test.go: a downloaded index moves the generation. It fails without the bump.

Checks:

Changelog: left to your batch. Suggested wording:

  • Device settings work from the first run. On a new install, OpenSave used to sync settings files such as graphics options between devices until it was restarted, and a weekly catalogue update took effect only at the next start. Both now take effect within a minute, without a restart.

@vercel

vercel Bot commented Oct 27, 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 27, 2026 9:50pm UTC

This branch was successfully deployed

1 active deployment
Preview — 13209790 Deployed Oct 27, 2026 by vercel[bot]
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