in src/Microsoft.Extensions.Configuration.AzureAppConfiguration/AzureAppConfigurationProvider.cs [640:703]
private async Task LoadAsync(bool ignoreFailures, CancellationToken cancellationToken)
{
var startupStopwatch = Stopwatch.StartNew();
int postFixedWindowAttempts = 0;
var startupExceptions = new List<Exception>();
try
{
while (true)
{
IEnumerable<ConfigurationClient> clients = _configClientManager.GetClients();
if (_requestTracingEnabled && _requestTracingOptions != null)
{
_requestTracingOptions.ReplicaCount = clients.Count() - 1;
}
if (await TryInitializeAsync(clients, startupExceptions, cancellationToken).ConfigureAwait(false))
{
break;
}
TimeSpan delay;
if (startupStopwatch.Elapsed.TryGetFixedBackoff(out TimeSpan backoff))
{
delay = backoff;
}
else
{
postFixedWindowAttempts++;
delay = FailOverConstants.MinStartupBackoffDuration.CalculateBackoffDuration(
FailOverConstants.MaxBackoffDuration,
postFixedWindowAttempts);
}
try
{
await Task.Delay(delay, cancellationToken).ConfigureAwait(false);
}
catch (OperationCanceledException)
{
throw new TimeoutException(
$"The provider timed out while attempting to load.",
new AggregateException(startupExceptions));
}
}
}
catch (Exception exception) when (
ignoreFailures &&
(exception is RequestFailedException ||
exception is KeyVaultReferenceException ||
exception is TimeoutException ||
exception is OperationCanceledException ||
exception is InvalidOperationException ||
exception is FormatException ||
((exception as AggregateException)?.InnerExceptions?.Any(e =>
e is RequestFailedException ||
e is OperationCanceledException) ?? false)))
{ }
}