Table of Contents

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

rule AsyncFunc<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

TEx

Exception 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

startTime TimeSpan

Initial delay for first retry.

maxAttempts int

Maximum allowed failed attempts.

factor float

Backoff multiplier for each subsequent retry delay.

jitter float

Randomization factor in range [0, 1).

Returns

IRetryRule<TEx>

Exponential backoff retry rule.

Type Parameters

TEx

Exception type handled by this rule.

Exceptions

ArgumentException

startTime is less than or equal to zero; maxAttempts is less than or equal to zero; or factor is less than or equal to zero.

ArgumentOutOfRangeException

jitter is outside [0, 1).