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

Avoid writing unchanged settings

This commit is contained in:
Nick O'Leary 2014-10-03 14:47:23 +01:00
parent 86d4179039
commit c223e7f58f

View File

@ -16,6 +16,8 @@
var when = require("when"); var when = require("when");
var assert = require("assert");
var userSettings = null; var userSettings = null;
var globalSettings = null; var globalSettings = null;
var storage = null; var storage = null;
@ -59,7 +61,13 @@ var persistentSettings = {
throw new Error("Settings not available"); throw new Error("Settings not available");
} }
globalSettings[prop] = value; globalSettings[prop] = value;
var current = persistentSettings.get(prop);
try {
assert.deepEqual(current,value);
return when.resolve();
} catch(err) {
return storage.saveSettings(globalSettings); return storage.saveSettings(globalSettings);
}
}, },
available: function() { available: function() {