5using System.Threading.Tasks;
14 Func<int, Exception, TimeSpan> delayProvider,
15 Action<int, Exception, TimeSpan>? onRetry =
null) =>
new RetryPolicy(maxAttempts, delayProvider, onRetry);
19 Func<int, Exception, TimeSpan> delayProvider,
20 Func<Exception, bool> shouldRetry,
21 Action<int, Exception, TimeSpan>? onRetry =
null) =>
new RetryPolicy(maxAttempts, delayProvider, onRetry, shouldRetry);
25 public static IAsyncPolicy Bulkhead(
int maxParallel,
int maxQueue = 0, Action? onRejected =
null) =>
new BulkheadPolicy(maxParallel, maxQueue, onRejected);
26 public static IAsyncPolicy CircuitBreaker(
int failureThreshold, TimeSpan breakDuration, Action<string>? onStateChange =
null)
Limits parallel executions, optionally bounding the queue. Rejects when saturated.
Simple circuit breaker: trips after N consecutive failures and stays open for a cool-down....
Delays execution by a quiet period. If a new task run starts during this delay, the run is canceled v...