pub struct BackoffConfig {
pub base_delay: Duration,
pub max_delay: Duration,
pub jitter_factor: f64,
pub multiplier: f64,
}Expand description
Exponential backoff configuration for reconnection.
This configuration controls how the WebSocket client calculates retry delays when attempting to reconnect after a connection failure.
§Example
use ccxt_core::ws_client::BackoffConfig;
use std::time::Duration;
let config = BackoffConfig {
base_delay: Duration::from_millis(500),
max_delay: Duration::from_secs(30),
jitter_factor: 0.2,
multiplier: 2.0,
};Fields§
§base_delay: DurationBase delay for first retry (default: 1 second)
This is the initial delay before the first reconnection attempt.
max_delay: DurationMaximum delay cap (default: 60 seconds)
The calculated delay will never exceed this value (before jitter).
jitter_factor: f64Jitter factor (0.0 - 1.0, default: 0.25 for 25%)
Random jitter is added to prevent thundering herd effect. The jitter range is [0, delay * jitter_factor].
multiplier: f64Multiplier for exponential growth (default: 2.0)
Each retry delay is multiplied by this factor.
Trait Implementations§
Source§impl Clone for BackoffConfig
impl Clone for BackoffConfig
Source§fn clone(&self) -> BackoffConfig
fn clone(&self) -> BackoffConfig
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 BackoffConfig
impl Debug for BackoffConfig
Auto Trait Implementations§
impl Freeze for BackoffConfig
impl RefUnwindSafe for BackoffConfig
impl Send for BackoffConfig
impl Sync for BackoffConfig
impl Unpin for BackoffConfig
impl UnwindSafe for BackoffConfig
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