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

Save downloaded config (fix #6694) #6885

Merged
merged 1 commit into from Aug 1, 2022
Merged

Save downloaded config (fix #6694) #6885

merged 1 commit into from Aug 1, 2022

Conversation

giejqf
Copy link
Contributor

@giejqf giejqf commented Aug 1, 2022

The downloaded config may fail to be saved because of a race condition in writeConfigDataFromSync().
Inside this function, the first line await this.platform.saveConfig(yaml.dump(data)) performs the save action in an async way (ipcRenderer.send / ipcMain.on). It is possible that the new config is not saved before invoking await this.config.load(), causing it to load the old config and then override the config file in await this.config.save().

This commit replaces (ipcRenderer.send / ipcMain.on) with (ipcRenderer.invoke / ipcMain.handle) to ensure that the new config is saved first.

@Eugeny Eugeny merged commit 04407b3 into Eugeny:master Aug 1, 2022
@Eugeny
Copy link
Owner

Eugeny commented Aug 1, 2022

Great find, much appreciated! @allcontributors please add @giejqf for code

@allcontributors
Copy link
Contributor

@Eugeny

I've put up a pull request to add @giejqf! 🎉

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.

None yet

2 participants