GMXRetryConfig
Documentation for eth_defi.gmx.retry.GMXRetryConfig Python class.
- class GMXRetryConfig
Bases:
objectConfiguration for GMX API retry and failover behaviour.
Controls how aggressively the GMX API client retries failed requests across multiple endpoints. Production defaults are tuned for reliability; tests should use
get_test_retry_config()for faster feedback.# Production (default) config = GMXRetryConfig() # Fast-fail for tests config = GMXRetryConfig.create_test_config()
Attributes summary
Maximum retry attempts per endpoint (primary, backup, fallback, fallback-2)
Initial delay in seconds between retries (grows with backoff)
Maximum delay cap in seconds for exponential backoff
Multiplier applied to delay after each failed attempt
Number of full cycles through all endpoints before giving up
Maximum age (seconds) of a last-known-good snapshot that may be served when
allow_stale_pricesis enabled.Serve a last-known-good snapshot on read-only paths when every endpoint fails.
Methods summary
__init__([max_retries, initial_delay, ...])Create a retry config tuned for fast test feedback.
- max_retries: int
Maximum retry attempts per endpoint (primary, backup, fallback, fallback-2)
- initial_delay: float
Initial delay in seconds between retries (grows with backoff)
- max_delay: float
Maximum delay cap in seconds for exponential backoff
- backoff_multiplier: float
Multiplier applied to delay after each failed attempt
- full_cycle_retries: int
Number of full cycles through all endpoints before giving up
- max_stale_seconds: float
Maximum age (seconds) of a last-known-good snapshot that may be served when
allow_stale_pricesis enabled.
- allow_stale_prices: bool
Serve a last-known-good snapshot on read-only paths when every endpoint fails. Default
False: existing behaviour unchanged until a consumer opts in. Never applies to signed-price paths.
- classmethod create_test_config()
Create a retry config tuned for fast test feedback.
Reduces retries and delays so tests fail quickly instead of burning minutes on unreachable API endpoints.
- Return type
- __init__(max_retries=3, initial_delay=2.0, max_delay=30.0, backoff_multiplier=2.0, full_cycle_retries=2, max_stale_seconds=120.0, allow_stale_prices=False)