FallbackResilienceStrategy<T>
using Polly.Telemetry;
using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace Polly.Fallback
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(new byte[] {
0,
1
})]
internal sealed class FallbackResilienceStrategy<[System.Runtime.CompilerServices.Nullable(2)] T> : ResilienceStrategy<T>
{
private readonly FallbackHandler<T> _handler;
[System.Runtime.CompilerServices.Nullable(new byte[] {
2,
0,
1
})]
private readonly Func<OnFallbackArguments<T>, ValueTask> _onFallback;
private readonly ResilienceStrategyTelemetry _telemetry;
public FallbackResilienceStrategy(FallbackHandler<T> handler, [System.Runtime.CompilerServices.Nullable(new byte[] {
2,
0,
1
})] Func<OnFallbackArguments<T>, ValueTask> onFallback, ResilienceStrategyTelemetry telemetry)
{
_handler = handler;
_onFallback = onFallback;
_telemetry = telemetry;
}
[AsyncStateMachine(typeof(<ExecuteCore>d__4<>))]
[return: System.Runtime.CompilerServices.Nullable(new byte[] {
0,
0,
1
})]
protected internal override ValueTask<Outcome<T>> ExecuteCore<[System.Runtime.CompilerServices.Nullable(2)] TState>([System.Runtime.CompilerServices.Nullable(new byte[] {
1,
1,
1,
0,
0,
1
})] Func<ResilienceContext, TState, ValueTask<Outcome<T>>> callback, ResilienceContext context, TState state)
{
<ExecuteCore>d__4<TState> stateMachine = default(<ExecuteCore>d__4<TState>);
stateMachine.<>t__builder = AsyncValueTaskMethodBuilder<Outcome<T>>.Create();
stateMachine.<>4__this = this;
stateMachine.callback = callback;
stateMachine.context = context;
stateMachine.state = state;
stateMachine.<>1__state = -1;
stateMachine.<>t__builder.Start(ref stateMachine);
return stateMachine.<>t__builder.Task;
}
}
}