struct

Crabbit::RecoveryPolicy

Inherits Struct < Value < Object

Exponential-backoff policy used when a producer or consumer reconnects.

Constructors

new(initial_delay : Time::Span = 250.milliseconds, max_delay : Time::Span = 30.seconds, multiplier : Float64 = 2.0, jitter : Float64 = 0.2)

Creates a recovery policy.

Delays grow as initial_delay * multiplier ** attempt, are capped at max_delay, and are randomized by up to jitter in either direction.

Source

Instance methods

delay(attempt : Int) : Time::Span

Returns the randomized delay for the zero-based retry attempt.

Source
initial_delay

Returns the delay before the first retry.

Source
jitter

Returns the proportional random jitter in the range 0.0..1.0.

Source
max_delay

Returns the maximum delay between retries.

Source
multiplier

Returns the exponential multiplier applied after each failed attempt.

Source