diff --git a/src/ServiceControl/CompositeViews/Messages/ScatterGatherApi.cs b/src/ServiceControl/CompositeViews/Messages/ScatterGatherApi.cs index 28055cff13..936ddf0924 100644 --- a/src/ServiceControl/CompositeViews/Messages/ScatterGatherApi.cs +++ b/src/ServiceControl/CompositeViews/Messages/ScatterGatherApi.cs @@ -33,6 +33,7 @@ protected ScatterGatherApi(TDataStore store, Settings settings, Func DataStore = store; Settings = settings; HttpClientFactory = httpClientFactory; + Logger = LogManager.GetLogger(GetType()); } protected TDataStore DataStore { get; } @@ -124,12 +125,18 @@ async Task> FetchAndParse(HttpRequestMessage currentRequest, U catch (HttpRequestException httpRequestException) { DisableRemoteInstance(remoteUri); - logger.Warn($"An HttpRequestException occurred when quering remote instance at {remoteUri}. The instance at uri: {remoteUri} will be temporarily disabled.", httpRequestException); + Logger.Warn($"An HttpRequestException occurred when quering remote instance at {remoteUri}. The instance at uri: {remoteUri} will be temporarily disabled.", + httpRequestException); + return QueryResult.Empty(); + } + catch (OperationCanceledException) + { + Logger.Warn($"Failed to query remote instance at {remoteUri} due to a timeout"); return QueryResult.Empty(); } catch (Exception exception) { - logger.Warn($"Failed to query remote instance at {remoteUri}.", exception); + Logger.Warn($"Failed to query remote instance at {remoteUri}.", exception); return QueryResult.Empty(); } } @@ -167,7 +174,7 @@ static async Task> ParseResult(HttpResponseMessage responseMes } } - static readonly ILog logger = LogManager.GetLogger(typeof(ScatterGatherApi)); + readonly ILog Logger; } abstract class ScatterGatherApiNoInput : ScatterGatherApi