Class RetryRule
- Namespace
- Executables.RetryRules
- Assembly
- executables.dll
Factory methods for building retry rules.
public static class RetryRule
- Inheritance
-
RetryRule
- Inherited Members
Methods
Create<TEx>(AsyncFunc<int, TEx, bool>)
Creates a retry rule from asynchronous delegate.
[Pure]
public static IRetryRule<TEx> Create<TEx>(AsyncFunc<int, TEx, bool> rule) where TEx : Exception
Parameters
ruleAsyncFunc<int, TEx, bool>Delegate that receives failed-attempt count and thrown exception, and returns true to continue retrying.
Returns
- IRetryRule<TEx>
Retry rule backed by provided delegate.
Type Parameters
TExException type handled by this rule.
ExponentialBackoff<TEx>(TimeSpan, int, float, float)
Creates a rule with exponential delay between retries.
[Pure]
public static IRetryRule<TEx> ExponentialBackoff<TEx>(TimeSpan startTime, int maxAttempts, float factor = 2, float jitter = 0) where TEx : Exception
Parameters
startTimeTimeSpanInitial delay for first retry.
maxAttemptsintMaximum allowed failed attempts.
factorfloatBackoff multiplier for each subsequent retry delay.
jitterfloatRandomization factor in range [0, 1).
Returns
- IRetryRule<TEx>
Exponential backoff retry rule.
Type Parameters
TExException type handled by this rule.
Exceptions
- ArgumentException
startTimeis less than or equal to zero;maxAttemptsis less than or equal to zero; orfactoris less than or equal to zero.- ArgumentOutOfRangeException
jitteris outside [0, 1).