def failure_backoff

cswap-bend-cli@0.1.0.0 · pollrow.bend:131

import cswap-bend-cli@0.1.0.0/pollrow.bend as Pollrow
import Base
import cswap-bend-cli@0.1.0.0/policy/usage.bend as PUsage
import cswap-bend-cli@0.1.0.0/poll.bend as Poll

131# Seconds to stay in backoff after the n-th failure: src/policy's backoff_for
132# (30 s * 2^(n-1) capped at 600 s; a Retry-After raises it).
133def failure_backoff(+failures: U32, retry_after: Maybe<&2, U32>, rate_limited: Bool) -> U32:
134  U32.from_nat(PUsage.backoff_for(U32.to_nat(failures), err_kind(rate_limited), Poll.nat_maybe(retry_after)))

Uses (8)

Used by (1)