[MM-39428] Check for EBUSY, add retry logic and logging for writing to config (#1845)
This commit is contained in:
@@ -179,7 +179,11 @@ export default class Config extends EventEmitter {
|
||||
try {
|
||||
this.writeFile(this.configFilePath, this.localConfigData, (error: NodeJS.ErrnoException | null) => {
|
||||
if (error) {
|
||||
throw new Error(error.message);
|
||||
if (error.code === 'EBUSY') {
|
||||
this.saveLocalConfigData();
|
||||
} else {
|
||||
this.emit('error', error);
|
||||
}
|
||||
}
|
||||
this.emit('update', this.combinedData);
|
||||
this.emit('synchronize');
|
||||
|
@@ -166,6 +166,9 @@ async function initializeConfig() {
|
||||
config.on('update', handleConfigUpdate);
|
||||
config.on('synchronize', handleConfigSynchronize);
|
||||
config.on('darkModeChange', handleDarkModeChange);
|
||||
config.on('error', (error) => {
|
||||
log.error(error);
|
||||
});
|
||||
handleConfigUpdate(configData);
|
||||
|
||||
// can only call this before the app is ready
|
||||
|
Reference in New Issue
Block a user