Skip to content

Retry policy

retry_policy

HTTP transport retry policy used inside :class:~durable_workflow.Client.

.. warning::

:class:TransportRetryPolicy covers only client-side HTTP retries for transient transport errors (connection failures, timeouts, 5xx responses, 429 rate-limiting). It is not the activity retry policy. Activity-level retry and timeout configuration lives on :class:durable_workflow.workflow.ActivityRetryPolicy and is passed to ctx.schedule_activity(..., retry_policy=...).

TransportRetryPolicy dataclass

TransportRetryPolicy(max_attempts=3, initial_backoff_seconds=0.1, max_backoff_seconds=5.0, backoff_multiplier=2.0, jitter=True)

Retry policy for transient HTTP transport errors.

Retries requests that fail with transient errors (connection errors, timeouts, 5xx server errors, 429 rate limit). Does not retry client errors (4xx except 429).

Uses exponential backoff with jitter to avoid thundering herd.

should_retry

should_retry(exc, attempt)

Check if the error is retryable and we haven't exceeded max attempts.

backoff_seconds

backoff_seconds(attempt)

Calculate backoff duration for the given attempt number (0-indexed).

execute async

execute(fn)

Execute the given async function with retries.

Raises the last exception if all retries are exhausted.