Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Less frequent writes of settings.json to sd/flash #295

Merged

Conversation

jdlcdl
Copy link
Collaborator

@jdlcdl jdlcdl commented Nov 26, 2023

Somewhat minor change to reduce how many writes of "settings.json" are made to flash/sd.

Defaults will be included because they are built-out as they are accessed. As the user navigates deeper into settings-namespaces, more defaults will be built out, so settings will be written more often than necessary.

  • krux.pages.settings_page accesses singleton "store" instead of class "Store"
  • krux.pages.settings_page explicitely calls store.save_settings() when exiting
  • krux.settings.Store adds attribute ".dirty" boolean to track settings changes
  • krux.settings.Store adds method ".update_file_location()" to delete old file
  • krux.settings.Store.save_settings() method writes only if ".dirty" and file would be altered
  • adds new tests and adjusts existing tests.

* krux.pages.settings_page accesses singleton "store" instead of class "Store"
* krux.pages.settings_page explicitely calls store.save_settings() when exiting
* krux.settings.Store adds attribute ".dirty" boolean to track settings changes
* krux.settings.Store adds method ".update_file_location()" to delete old file
* krux.settings.Store.save_settings() method writes only if ".dirty" and file would be altered
* adds new tests and adjusts existing tests.
@jdlcdl jdlcdl marked this pull request as draft November 26, 2023 12:22
@odudex odudex merged commit 72055e0 into selfcustody:integrated_changes Nov 29, 2023
2 of 5 checks passed
@jdlcdl jdlcdl deleted the reduced_settings_writes branch November 29, 2023 17:13
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.

2 participants