3using System.Threading.Tasks;
13 private readonly TimeSpan delay;
17 ArgumentOutOfRangeException.ThrowIfLessThan(Delay, TimeSpan.Zero);
21 public async Task ExecuteAsync(Func<CancellationToken, Task> action, CancellationToken ct)
23 if (this.delay > TimeSpan.Zero)
24 await Task.Delay(this.delay, ct);
29 public async Task<T>
ExecuteAsync<T>(Func<CancellationToken, Task<T>> action, CancellationToken ct)
31 if (this.delay > TimeSpan.Zero)
32 await Task.Delay(this.delay, ct);
34 return await action(ct);
Delays execution by a quiet period. If a new task run starts during this delay, the run is canceled v...
async Task< T > ExecuteAsync< T >(Func< CancellationToken, Task< T > > action, CancellationToken ct)
Executes an async action producing a value through the policy pipeline.