-
Notifications
You must be signed in to change notification settings - Fork 277
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
Refactor settings.load
into more sensible functions
#5043
Merged
Merged
Conversation
This file contains 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
mook-as
previously requested changes
Jun 23, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocking merge because of the big warning in the description.
Feel free to dismiss this once that's been resolved.
(I haven't looked at the changes at all.)
ericpromislow
force-pushed
the
5022-refactor-settings-load
branch
from
June 29, 2023 22:58
6086342
to
a36588e
Compare
ericpromislow
force-pushed
the
5022-refactor-settings-load
branch
from
June 29, 2023 23:01
a36588e
to
c17cc09
Compare
ericpromislow
force-pushed
the
5022-refactor-settings-load
branch
from
July 3, 2023 21:45
c17cc09
to
9ac345b
Compare
ericpromislow
force-pushed
the
5022-refactor-settings-load
branch
from
July 6, 2023 17:13
9ac345b
to
7d37c88
Compare
mook-as
previously approved these changes
Jul 6, 2023
- getSettings: just return the current settings - createSettings: create a new settings object, based on defaults and any deployment profiles (and save it) - load: Either call createSettings if there's no settings.json, otherwise load it. - updateSettings: renamed as migrateSettingsToCurrentVersion because `updateSettings` is now a function to update the settings via the API. Set-up code common to both `load` and `createSettings` has been pulled out into a separate function `finishConfiguringSettings`, which does any sanity-checking and merges in any locked-field settings. The `getSettings` call is made to return the current settings from the main process, which can't send a message requesting them. Now the only place `settings.load` is called is during startup in `background.ts`. And now the unit tests can simply call `createSettings` which will read in the current deployment profile, no need to do an artificial `settings.clear()`. Signed-off-by: Eric Promislow <epromislow@suse.com>
ericpromislow
force-pushed
the
5022-refactor-settings-load
branch
from
July 6, 2023 22:49
7d37c88
to
599fc02
Compare
mook-as
approved these changes
Jul 6, 2023
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.
Fixes #5022
This breaks the
settings.load
function into three main parts - one for loading an existing settings.json file, one for creating a new one, and common code used by both after the settings object has been created or loaded.There's also a
getSettings
function, because overloadingsettings.load
to create, load from disk, and retrieve from memory was too complex and error-prone.Also the default memory value is calculated on the default settings object, because it's extremely unlikely to change while the program is running (ignore what it means for RD to run on a multi-node system and get handed over from one machine to another).