flix

0.70.0

Net.Retry

Definitions

def exponential(mr: { maxRetries = Int32 }, bdm: { baseDelay = Duration }): Int32 -> (HttpRequest -> (RetryOutcome -> RetryDecision)) Source

Returns a strategy with exponential backoff.

Retries up to maxRetries times with delays: baseDelay, 2*base, 4*base, …

def linear(mr: { maxRetries = Int32 }, dm: { delay = Duration }): Int32 -> (HttpRequest -> (RetryOutcome -> RetryDecision)) Source

Returns a strategy that retries up to maxRetries times with a fixed delay.

def noRetry(): Int32 -> (HttpRequest -> (RetryOutcome -> RetryDecision)) Source

Returns a strategy that never retries.

def retryAfter(mr: { maxRetries = Int32 }, bdm: { baseDelay = Duration }): Int32 -> (HttpRequest -> (RetryOutcome -> RetryDecision)) Source

Returns a strategy that retries up to maxRetries times, honouring an integer-seconds Retry-After response header on 429/503 responses.

Falls back to baseDelay when the header is absent or unparseable.

def retryTransportOnly(mr: { maxRetries = Int32 }, dm: { delay = Duration }): Int32 -> (HttpRequest -> (RetryOutcome -> RetryDecision)) Source

Returns a strategy that retries up to maxRetries times with a fixed delay, but only on transport errors (connection refused, timeout, etc.).

HTTP-level errors (non-2xx responses) are never retried.

def withDeadline(dlm: { deadline = Duration }, sm: { startMs = Int64 }, inner: Int32 -> (HttpRequest -> (RetryOutcome -> RetryDecision \ ef))): Int32 -> (HttpRequest -> (RetryOutcome -> RetryDecision \ ef + Clock)) Source

Wraps inner and clamps any Retry delay to the time remaining before the deadline.

startMs should be the result of Clock.now() captured before entering the retry loop. Returns Stop if the deadline is already past.

def withJitter(mjm: { maxJitter = Duration }, inner: Int32 -> (HttpRequest -> (RetryOutcome -> RetryDecision \ ef))): Int32 -> (HttpRequest -> (RetryOutcome -> RetryDecision \ ef + Random)) Source

Wraps inner by adding uniform random jitter in [0, maxJitter] to any Retry delay.