Skip to content

Commit 57a5e49

Browse files
committed
#183 Added some better optimizations / checks around SettingsManager.Apply
1 parent c3a2e15 commit 57a5e49

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/Exceptionless/Configuration/SettingsManager.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,8 @@ public static void UpdateSettings(ExceptionlessConfiguration config, int? versio
8888

8989
// TODO: Store snapshot of settings after reading from config and attributes and use that to revert to defaults.
9090
// Remove any existing server settings that are not in the new server settings.
91-
foreach (string key in savedServerSettings.Keys.Except(response.Settings.Keys)) {
92-
if (config.Settings.ContainsKey(key))
93-
config.Settings.Remove(key);
94-
}
91+
foreach (string key in savedServerSettings.Keys.Except(response.Settings.Keys))
92+
config.Settings.Remove(key);
9593

9694
var persistedClientData = config.Resolver.Resolve<PersistedDictionary>();
9795
persistedClientData[String.Concat(config.GetQueueName(), "-ServerConfigVersion")] = response.SettingsVersion.ToString();

src/Exceptionless/Models/Collections/SettingsDictionary.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,11 @@ public void Apply(IEnumerable<KeyValuePair<string, string>> values) {
319319
return;
320320

321321
foreach (var v in values) {
322-
if (!ContainsKey(v.Key) || v.Value != this[v.Key])
322+
if (v.Key == null)
323+
continue;
324+
325+
string temp;
326+
if (!TryGetValue(v.Key, out temp) || v.Value != temp)
323327
this[v.Key] = v.Value;
324328
}
325329
}

0 commit comments

Comments
 (0)