pub struct RetryConfig {
pub initial_delay: Duration,
pub max_delay: Duration,
pub factor: f64,
pub max_retries: Option<usize>,
}Expand description
Configuration for connection/operation retry behavior.
Use the preset constructors for common patterns:
RetryConfig::startup()- Fast-fail for initial connectionsRetryConfig::daemon()- Infinite retry for runtime reconnectionRetryConfig::query()- Quick retry for individual operations
Fields§
§initial_delay: Duration§max_delay: Duration§factor: f64§max_retries: Option<usize>Implementations§
Source§impl RetryConfig
impl RetryConfig
Sourcepub fn startup() -> Self
pub fn startup() -> Self
Fast-fail retry for initial startup connection. Attempts 5 times with exponential backoff, failing after ~5 seconds. Use this during daemon startup to detect configuration errors quickly.
Sourcepub fn daemon() -> Self
pub fn daemon() -> Self
Infinite retry for long-running daemon (never give up!). Retries forever with exponential backoff capped at 5 minutes. Use this for runtime reconnection after initial startup succeeds.
Sourcepub fn query() -> Self
pub fn query() -> Self
Quick retry for individual queries (don’t block forever). 3 attempts with fast backoff - if it fails, let caller handle it.
Sourcepub fn batch_write() -> Self
pub fn batch_write() -> Self
Retry config for batch writes (SQL/Redis).
More aggressive than query() to handle transient deadlocks (MySQL 1213)
and connection contention under high concurrency. 5 attempts with
randomized initial delay to reduce thundering herd.
Trait Implementations§
Source§impl Clone for RetryConfig
impl Clone for RetryConfig
Source§fn clone(&self) -> RetryConfig
fn clone(&self) -> RetryConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more