aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/AppBase
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2021-06-12 00:20:54 +0200
committerGitHub <noreply@github.com>2021-06-12 00:20:54 +0200
commitcfad97ff28339088ab86c40661bb407024285a7c (patch)
tree152c04363e23e233229a7b40080d388a13046657 /Emby.Server.Implementations/AppBase
parentadf406b1821800bbf1b214c4ac673defa362e4f4 (diff)
parent66de8428960ec751521386c27e37909cf73add9e (diff)
Merge pull request #6096 from cvium/saving_private_ram
Diffstat (limited to 'Emby.Server.Implementations/AppBase')
-rw-r--r--Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs34
1 files changed, 19 insertions, 15 deletions
diff --git a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
index 4c442a473..d38535634 100644
--- a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
+++ b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
@@ -299,25 +299,29 @@ namespace Emby.Server.Implementations.AppBase
/// <inheritdoc />
public object GetConfiguration(string key)
{
- return _configurations.GetOrAdd(key, k =>
- {
- var file = GetConfigurationFile(key);
+ return _configurations.GetOrAdd(
+ key,
+ (k, configurationManager) =>
+ {
+ var file = configurationManager.GetConfigurationFile(k);
- var configurationInfo = _configurationStores
- .FirstOrDefault(i => string.Equals(i.Key, key, StringComparison.OrdinalIgnoreCase));
+ var configurationInfo = Array.Find(
+ configurationManager._configurationStores,
+ i => string.Equals(i.Key, k, StringComparison.OrdinalIgnoreCase));
- if (configurationInfo == null)
- {
- throw new ResourceNotFoundException("Configuration with key " + key + " not found.");
- }
+ if (configurationInfo == null)
+ {
+ throw new ResourceNotFoundException("Configuration with key " + k + " not found.");
+ }
- var configurationType = configurationInfo.ConfigurationType;
+ var configurationType = configurationInfo.ConfigurationType;
- lock (_configurationSyncLock)
- {
- return LoadConfiguration(file, configurationType);
- }
- });
+ lock (configurationManager._configurationSyncLock)
+ {
+ return configurationManager.LoadConfiguration(file, configurationType);
+ }
+ },
+ this);
}
private object LoadConfiguration(string path, Type configurationType)