AsyncRetryEngine
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
namespace Polly.Retry
{
internal static class AsyncRetryEngine
{
[System.Runtime.CompilerServices.NullableContext(1)]
[AsyncStateMachine(typeof(<ImplementationAsync>d__0<>))]
internal static Task<TResult> ImplementationAsync<[System.Runtime.CompilerServices.Nullable(2)] TResult>(Func<Context, CancellationToken, Task<TResult>> action, Context context, ExceptionPredicates shouldRetryExceptionPredicates, ResultPredicates<TResult> shouldRetryResultPredicates, Func<DelegateResult<TResult>, TimeSpan, int, Context, Task> onRetryAsync, CancellationToken cancellationToken, int permittedRetryCount = int.MaxValue, [System.Runtime.CompilerServices.Nullable(2)] IEnumerable<TimeSpan> sleepDurationsEnumerable = null, [System.Runtime.CompilerServices.Nullable(new byte[] {
2,
1,
1,
1
})] Func<int, DelegateResult<TResult>, Context, TimeSpan> sleepDurationProvider = null, bool continueOnCapturedContext = false)
{
<ImplementationAsync>d__0<TResult> stateMachine = default(<ImplementationAsync>d__0<TResult>);
stateMachine.<>t__builder = AsyncTaskMethodBuilder<TResult>.Create();
stateMachine.action = action;
stateMachine.context = context;
stateMachine.shouldRetryExceptionPredicates = shouldRetryExceptionPredicates;
stateMachine.shouldRetryResultPredicates = shouldRetryResultPredicates;
stateMachine.onRetryAsync = onRetryAsync;
stateMachine.cancellationToken = cancellationToken;
stateMachine.permittedRetryCount = permittedRetryCount;
stateMachine.sleepDurationsEnumerable = sleepDurationsEnumerable;
stateMachine.sleepDurationProvider = sleepDurationProvider;
stateMachine.continueOnCapturedContext = continueOnCapturedContext;
stateMachine.<>1__state = -1;
stateMachine.<>t__builder.Start(ref stateMachine);
return stateMachine.<>t__builder.Task;
}
}
}