adjustments for grpc service client

This commit is contained in:
rootdarkarchon
2022-12-27 20:08:18 +01:00
parent 4d1ef1f871
commit b8c10c4298

View File

@@ -52,10 +52,26 @@ public class MareConfigurationServiceClient<T> : IConfigurationService<T> where
if (!isCurrent)
{
var result = GetValueFromGrpc(key, defaultValue, prop.PropertyType);
if (result == null) return defaultValue;
_cachedRemoteProperties[key] = result;
return (T1)_cachedRemoteProperties[key].Value;
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;
}
}
}
}