1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Add mutex lock to saveSettings storage call

Fixes #2736
This commit is contained in:
Nick O'Leary 2020-10-28 21:59:22 +00:00
parent 0ecd9673b8
commit 9d7a450821
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -25,6 +25,9 @@ var storageModule;
var settingsAvailable;
var sessionsAvailable;
var Mutex = require('async-mutex').Mutex;
const settingsSaveMutex = new Mutex();
var libraryFlowsCachedResult = null;
function moduleSelector(aSettings) {
@ -114,7 +117,7 @@ var storageModuleInterface = {
},
saveSettings: function(settings) {
if (settingsAvailable) {
return storageModule.saveSettings(settings);
return settingsSaveMutex.runExclusive(() => storageModule.saveSettings(settings))
} else {
return when.resolve();
}