pub struct RetryConfig {
pub max_retries: u32,
pub initial_backoff: Duration,
pub max_backoff: Duration,
pub jitter_factor: f64,
}Expand description
Configuration for automatic request retries with exponential backoff and jitter.
Only idempotent HTTP methods (GET, DELETE) are retried automatically.
POST requests are never retried by default to prevent duplicate order submissions.
§Example
use polymarket_us::{PolymarketUsClient, RetryConfig};
use std::time::Duration;
let client = PolymarketUsClient::builder()
.retry(RetryConfig {
max_retries: 5,
initial_backoff: Duration::from_millis(100),
max_backoff: Duration::from_secs(30),
jitter_factor: 0.3,
})
.build()
.unwrap();Fields§
§max_retries: u32Maximum number of retry attempts (0 = no retries). Default: 3.
initial_backoff: DurationInitial backoff before the first retry. Default: 200ms.
max_backoff: DurationUpper bound on backoff after exponential growth. Default: 10s.
jitter_factor: f64Fraction of the computed backoff added as random jitter (0.0–1.0).
Prevents thundering-herd retry storms. Default: 0.25.
Implementations§
Source§impl RetryConfig
impl RetryConfig
Sourcepub fn aggressive() -> Self
pub fn aggressive() -> Self
Aggressive retry settings for resilient workflows.
Trait Implementations§
Source§impl Clone for RetryConfig
impl Clone for RetryConfig
Source§fn clone(&self) -> RetryConfig
fn clone(&self) -> RetryConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RetryConfig
impl Debug for RetryConfig
Source§impl Default for RetryConfig
impl Default for RetryConfig
Source§impl PartialEq for RetryConfig
impl PartialEq for RetryConfig
Source§fn eq(&self, other: &RetryConfig) -> bool
fn eq(&self, other: &RetryConfig) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for RetryConfig
Auto Trait Implementations§
impl Freeze for RetryConfig
impl RefUnwindSafe for RetryConfig
impl Send for RetryConfig
impl Sync for RetryConfig
impl Unpin for RetryConfig
impl UnsafeUnpin for RetryConfig
impl UnwindSafe for RetryConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more