diff --git a/MareSynchronosServer/MareSynchronosShared/Services/MareConfigurationServiceClient.cs b/MareSynchronosServer/MareSynchronosShared/Services/MareConfigurationServiceClient.cs index 39d014b..0f858e2 100644 --- a/MareSynchronosServer/MareSynchronosShared/Services/MareConfigurationServiceClient.cs +++ b/MareSynchronosServer/MareSynchronosShared/Services/MareConfigurationServiceClient.cs @@ -20,7 +20,6 @@ public class MareConfigurationServiceClient : IConfigurationService where private readonly ILogger> _logger; private readonly GrpcClientFactory _grpcClientFactory; private readonly string _grpcClientName; - private static readonly SemaphoreSlim _readLock = new(1); public MareConfigurationServiceClient(ILogger> logger, IOptions config, GrpcClientFactory grpcClientFactory, string grpcClientName) { @@ -40,10 +39,8 @@ public class MareConfigurationServiceClient : IConfigurationService where bool isRemote = prop.GetCustomAttributes(typeof(RemoteConfigurationAttribute), inherit: true).Any(); if (isRemote) { - _readLock.Wait(); if (_cachedRemoteProperties.TryGetValue(key, out var existingEntry)) { - _readLock.Release(); return (T1)_cachedRemoteProperties[key].Value; } @@ -67,10 +64,6 @@ public class MareConfigurationServiceClient : IConfigurationService where return defaultValue; } } - finally - { - _readLock.Release(); - } } var value = prop.GetValue(_config); @@ -103,10 +96,8 @@ public class MareConfigurationServiceClient : IConfigurationService where bool isRemote = prop.GetCustomAttributes(typeof(RemoteConfigurationAttribute), inherit: true).Any(); if (isRemote) { - _readLock.Wait(); - if (_cachedRemoteProperties.TryGetValue(key, out var existingEntry) && existingEntry.Inserted > DateTime.Now - TimeSpan.FromMinutes(60)) + if (_cachedRemoteProperties.TryGetValue(key, out var existingEntry)) { - _readLock.Release(); return (T1)_cachedRemoteProperties[key].Value; } @@ -130,10 +121,6 @@ public class MareConfigurationServiceClient : IConfigurationService where throw new KeyNotFoundException(key); } } - finally - { - _readLock.Release(); - } } var value = prop.GetValue(_config);