Logo Orsak

Delay Module

The backoff calculation used by the retrying effects in Orsak.Resilience: an exponentially growing delay, with random jitter, based on Polly's "decorrelated jitter backoff V2".

Functions and values

Function or value Description

ExponentialFactor

Full Usage: ExponentialFactor

Returns: float

The base of the exponential growth of the delay.

Returns: float

Pfactor

Full Usage: Pfactor

Returns: float

A factor that dampens the growth of the first few delays.

Returns: float

RpScalingFactor

Full Usage: RpScalingFactor

Returns: float

Scales the delay, so that the median of the first delay is the base delay.

Returns: float

calculateDelayWithJitter attempt prev baseDelay randomizer

Full Usage: calculateDelayWithJitter attempt prev baseDelay randomizer

Parameters:
    attempt : int64 - The number of the attempt, from 0
    prev : byref<float> - The state of the calculation between attempts, updated by the call; start with 0
    baseDelay : TimeSpan - The median of the first delay
    randomizer : IRandomGenerator - The source of the jitter

Returns: TimeSpan

The delay before retry attempt, with jitter.

attempt : int64

The number of the attempt, from 0

prev : byref<float>

The state of the calculation between attempts, updated by the call; start with 0

baseDelay : TimeSpan

The median of the first delay

randomizer : IRandomGenerator

The source of the jitter

Returns: TimeSpan

getDelay attempt prev baseDelay maxDelay randomizer

Full Usage: getDelay attempt prev baseDelay maxDelay randomizer

Parameters:
    attempt : int64 - The number of the attempt, from 0
    prev : byref<float> - The state of the calculation between attempts, updated by the call; start with 0
    baseDelay : TimeSpan - The median of the first delay
    maxDelay : Nullable<TimeSpan> - The longest delay, or no limit
    randomizer : IRandomGenerator - The source of the jitter

Returns: TimeSpan

The delay before retry attempt, with jitter, capped at maxDelay.

attempt : int64

The number of the attempt, from 0

prev : byref<float>

The state of the calculation between attempts, updated by the call; start with 0

baseDelay : TimeSpan

The median of the first delay

maxDelay : Nullable<TimeSpan>

The longest delay, or no limit

randomizer : IRandomGenerator

The source of the jitter

Returns: TimeSpan

Type something to start searching.