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:
objectRetry + rate-limit adapter wrapping an inner AsyncHTTPSession.
- async restgdf.resilience.bounded_retry_timeout(func, *, max_attempts, url)[source]¶
Invoke
funcwith 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
RestgdfTimeoutErrormessage on exhaustion.