RetryPolicy class
Exponential backoff with jitter, a max attempt count and a cooldown (ADR-008). Pure math — the controllers own the timers.
Semantics: attempt is the number of failures so far (1-based after the
first failure). While shouldRetry is true, wait nextDelay and try
again; once it turns false, wait cooldown, reset the attempt counter,
and auto re-arm.
Constructors
- RetryPolicy(RetryConfig _config, {double random()?})
-
Creates a policy from a RetryConfig.
random(returning values in the half-open range 0 to 1) is injectable for deterministic tests.
Properties
- cooldown → Duration
-
How long to back off after the attempt budget is exhausted, before
auto re-arming.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- loadTimeout → Duration?
-
The per-load watchdog bound (null = disabled) — see
RetryConfig.loadTimeout.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
gateRecheckDelay(
int attempt) → Duration - How long to wait before re-checking a gate that was CLOSED (consent not settled yet, or ads disabled) — as opposed to a load that FAILED.
-
nextDelay(
int attempt) → Duration -
The backoff delay after
attemptfailures (1-based):baseDelay * 2^(attempt-1), jittered by ±jitterFactor, capped atmaxDelay. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
shouldRetry(
int attempt) → bool -
Whether another retry is allowed after
attemptfailures. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited