ExecutionTrackingComponent
using System;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
namespace Polly.Utils.Pipeline
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
internal sealed class ExecutionTrackingComponent : PipelineComponent
{
public static readonly TimeSpan Timeout = TimeSpan.FromSeconds(30);
public static readonly TimeSpan SleepDelay = TimeSpan.FromSeconds(1);
private readonly TimeProvider _timeProvider;
private int _pendingExecutions;
public PipelineComponent Component { get; }
public bool HasPendingExecutions => Interlocked.CompareExchange(ref _pendingExecutions, 0, 0) > 0;
public ExecutionTrackingComponent(PipelineComponent component, TimeProvider timeProvider)
{
Component = component;
_timeProvider = timeProvider;
}
[AsyncStateMachine(typeof(<ExecuteCore>d__10<, >))]
[return: System.Runtime.CompilerServices.Nullable(new byte[] {
0,
0,
1
})]
internal override ValueTask<Outcome<TResult>> ExecuteCore<[System.Runtime.CompilerServices.Nullable(2)] TResult, [System.Runtime.CompilerServices.Nullable(2)] TState>([System.Runtime.CompilerServices.Nullable(new byte[] {
1,
1,
1,
0,
0,
1
})] Func<ResilienceContext, TState, ValueTask<Outcome<TResult>>> callback, ResilienceContext context, TState state)
{
<ExecuteCore>d__10<TResult, TState> stateMachine = default(<ExecuteCore>d__10<TResult, TState>);
stateMachine.<>t__builder = AsyncValueTaskMethodBuilder<Outcome<TResult>>.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;
}
[AsyncStateMachine(typeof(<DisposeAsync>d__11))]
public override ValueTask DisposeAsync()
{
<DisposeAsync>d__11 stateMachine = default(<DisposeAsync>d__11);
stateMachine.<>t__builder = AsyncValueTaskMethodBuilder.Create();
stateMachine.<>4__this = this;
stateMachine.<>1__state = -1;
stateMachine.<>t__builder.Start(ref stateMachine);
return stateMachine.<>t__builder.Task;
}
}
}