remove semaphore
This commit is contained in:
		| @@ -20,7 +20,6 @@ public class MareConfigurationServiceClient<T> : IConfigurationService<T> where | ||||
|     private readonly ILogger<MareConfigurationServiceClient<T>> _logger; | ||||
|     private readonly GrpcClientFactory _grpcClientFactory; | ||||
|     private readonly string _grpcClientName; | ||||
|     private static readonly SemaphoreSlim _readLock = new(1); | ||||
|  | ||||
|     public MareConfigurationServiceClient(ILogger<MareConfigurationServiceClient<T>> logger, IOptions<T> config, GrpcClientFactory grpcClientFactory, string grpcClientName) | ||||
|     { | ||||
| @@ -40,10 +39,8 @@ public class MareConfigurationServiceClient<T> : IConfigurationService<T> 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<T> : IConfigurationService<T> where | ||||
|                     return defaultValue; | ||||
|                 } | ||||
|             } | ||||
|             finally | ||||
|             { | ||||
|                 _readLock.Release(); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         var value = prop.GetValue(_config); | ||||
| @@ -103,10 +96,8 @@ public class MareConfigurationServiceClient<T> : IConfigurationService<T> 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<T> : IConfigurationService<T> where | ||||
|                     throw new KeyNotFoundException(key); | ||||
|                 } | ||||
|             } | ||||
|             finally | ||||
|             { | ||||
|                 _readLock.Release(); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         var value = prop.GetValue(_config); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 rootdarkarchon
					rootdarkarchon