Skip to content
ocx
install

RetryPolicy

RetryPolicyclassdataclass#

Re-exported from ocx_sdk._typesView source
class RetryPolicy(attempts: int = 3, backoff: float = 1.0, multiplier: float = 2.0, max_backoff: float = 30.0, max_retry_after: float = 300.0, jitter: bool = True, retry_on: frozenset[ExitCode] = frozenset({ExitCode.TEMP_FAIL}), sleep: Callable[[float], None] | None = None)

How to retry a failure ocx classified as transient.

Attempt one is not a retry: attempts=3 means at most two backoff waits. timeout is per attempt, so the worst case is attempts * timeout + sum(backoff).

Attributes

NameTypeDescription
attemptsintTotal attempts, including the first.
backofffloatDelay before the first retry, in seconds.
multiplierfloatGrowth factor applied to backoff per retry.
max_backofffloatCeiling for the computed delay.
max_retry_afterfloatCeiling for a server-supplied Retry-After. It is honored verbatim up to this value rather than truncated to max_backoff — truncating it would hammer a registry that just asked for room. Beyond it the answer is to fail, not to wait.
jitterboolDraw the delay uniformly from [0, delay] (AWS full jitter).
retry_onfrozenset[ExitCode]Exit codes worth retrying. Applies to the process path only; _dist classifies by transport condition instead, so this set does not affect bootstrap.ensure().
sleepCallable[[float], None] | NoneSleep seam, defaulting to time.sleep. Async drivers use asyncio.sleep and ignore this field.

attemptsattributeclass attributeinstance attribute#

attempts: int = 3

backoffattributeclass attributeinstance attribute#

backoff: float = 1.0

jitterattributeclass attributeinstance attribute#

jitter: bool = True

max_backoffattributeclass attributeinstance attribute#

max_backoff: float = 30.0

max_retry_afterattributeclass attributeinstance attribute#

max_retry_after: float = 300.0

multiplierattributeclass attributeinstance attribute#

multiplier: float = 2.0

retry_onattributeclass attributeinstance attribute#

retry_on: frozenset[ExitCode] = frozenset({ExitCode.TEMP_FAIL})

sleepattributeclass attributeinstance attribute#

sleep: Callable[[float], None] | None = None