mirror of
https://github.com/Caraxi/mare.server.git
synced 2025-12-12 20:17:22 +01:00
adjustments for grpc service client
This commit is contained in:
parent
4d1ef1f871
commit
b8c10c4298
1 changed files with 20 additions and 4 deletions
|
|
@ -51,12 +51,28 @@ public class MareConfigurationServiceClient<T> : IConfigurationService<T> where
|
|||
}
|
||||
|
||||
if (!isCurrent)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = GetValueFromGrpc(key, defaultValue, prop.PropertyType);
|
||||
if (result == null) return defaultValue;
|
||||
_cachedRemoteProperties[key] = result;
|
||||
return (T1)_cachedRemoteProperties[key].Value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (existingEntry != null)
|
||||
{
|
||||
_logger.LogWarning(ex, "Could not get value for {key} from Grpc, returning existing", key);
|
||||
return (T1)existingEntry.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogWarning(ex, "Could not get value for {key} from Grpc, returning default", key);
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var value = prop.GetValue(_config);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue