pub struct ReconnectionConfig {
pub enabled: bool,
pub initial_delay: Duration,
pub max_delay: Duration,
pub max_attempts: Option<u32>,
pub backoff_multiplier: f64,
pub jitter: bool,
pub jitter_enabled: bool,
pub timeout: Duration,
}
Expand description
Configuration for reconnection behavior
Fields§
§enabled: bool
Whether automatic reconnection is enabled
initial_delay: Duration
Initial delay before the first reconnection attempt
max_delay: Duration
Maximum delay between reconnection attempts
max_attempts: Option<u32>
Maximum number of reconnection attempts (None for unlimited)
backoff_multiplier: f64
Multiplier for exponential backoff between attempts
jitter: bool
Whether to add random jitter to delays (deprecated, use jitter_enabled)
jitter_enabled: bool
Whether to add random jitter to delays to avoid thundering herd
timeout: Duration
Timeout for each connection attempt
Implementations§
Source§impl ReconnectionConfig
impl ReconnectionConfig
Sourcepub fn conservative() -> Self
pub fn conservative() -> Self
Creates a conservative reconnection config
Sourcepub fn with_enabled(self, enabled: bool) -> Self
pub fn with_enabled(self, enabled: bool) -> Self
Sets whether reconnection is enabled
Sourcepub fn with_max_attempts(self, max_attempts: u32) -> Self
pub fn with_max_attempts(self, max_attempts: u32) -> Self
Sets the maximum number of reconnection attempts
Sourcepub fn with_initial_delay(self, initial_delay: Duration) -> Self
pub fn with_initial_delay(self, initial_delay: Duration) -> Self
Sets the initial delay between reconnection attempts
Sourcepub fn with_max_delay(self, max_delay: Duration) -> Self
pub fn with_max_delay(self, max_delay: Duration) -> Self
Sets the maximum delay between reconnection attempts
Sourcepub fn with_backoff_multiplier(self, multiplier: f64) -> Self
pub fn with_backoff_multiplier(self, multiplier: f64) -> Self
Sets the backoff multiplier
Sourcepub fn with_jitter_enabled(self, jitter_enabled: bool) -> Self
pub fn with_jitter_enabled(self, jitter_enabled: bool) -> Self
Sets whether jitter is enabled
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Sets the connection timeout
Trait Implementations§
Source§impl Clone for ReconnectionConfig
impl Clone for ReconnectionConfig
Source§fn clone(&self) -> ReconnectionConfig
fn clone(&self) -> ReconnectionConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more