<PackageReference Include="Polly.Core" Version="8.4.1" />

ExecutionTrackingComponent

using System; using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; namespace Polly.Utils.Pipeline { [NullableContext(1)] [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: Nullable(new byte[] { 0, 0, 1 })] internal override ValueTask<Outcome<TResult>> ExecuteCore<[Nullable(2)] TResult, [Nullable(2)] TState>([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; } } }