Resilience

The restgdf[resilience] extra adds automatic retry with exponential back-off, per-service-root rate limiting, and 429 cooldown handling. Install it alongside the base package:

pip install "restgdf[resilience]"

See Tracing & Observability for a practical integration guide.

restgdf.resilience

Resilience adapter for restgdf (BL-31).

Provides ResilientSession, a retry + rate-limit wrapper that implements the AsyncHTTPSession protocol. Requires the resilience extra (stamina + aiolimiter).

Usage:

pip install restgdf[resilience]

from restgdf.resilience import ResilientSession
class restgdf.resilience.ResilientSession(inner, config)[source]

Bases: object

Retry + rate-limit adapter wrapping an inner AsyncHTTPSession.

property closed: bool
async close()[source]
get(url, **kwargs)[source]
post(url, **kwargs)[source]
async restgdf.resilience.bounded_retry_timeout(func, *, max_attempts, url)[source]

Invoke func with bounded retry on timeout exceptions.

Parameters:
  • func – Zero-argument awaitable factory (call produces the coroutine to run).

  • max_attempts – Maximum number of attempts, identical to the inline fallback.

  • url – Used only to build the RestgdfTimeoutError message on exhaustion.