pub struct RetryConfig {
pub max_retries: usize,
pub initial_delay: Duration,
pub max_delay: Duration,
pub backoff_multiplier: f64,
pub jitter: bool,
}Expand description
Configuration for exponential backoff retry behavior.
This struct controls how failed requests are retried with increasing delays between attempts. Supports optional jitter to avoid thundering herd problems.
§Examples
use std::time::Duration;
use neuromance_common::client::RetryConfig;
// Conservative retry policy
let config = RetryConfig {
max_retries: 5,
initial_delay: Duration::from_millis(500),
max_delay: Duration::from_secs(60),
backoff_multiplier: 2.0,
jitter: true,
};Fields§
§max_retries: usizeMaximum number of retry attempts before failing.
initial_delay: DurationInitial delay before the first retry attempt.
max_delay: DurationMaximum delay between retry attempts (caps exponential growth).
backoff_multiplier: f64Multiplier for exponential backoff (typically 2.0 for doubling).
jitter: boolWhether to add random jitter to retry delays to prevent thundering herd.
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 · 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
Auto Trait Implementations§
impl Freeze for RetryConfig
impl RefUnwindSafe for RetryConfig
impl Send for RetryConfig
impl Sync for RetryConfig
impl Unpin 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