pub struct RetryConfig {
pub initial_interval: Duration,
pub max_interval: Duration,
pub factor: f64,
pub max_retries: Option<usize>,
}Expand description
Reconnection backoff for the SSE stream.
Maps directly onto reqwest_eventsource’s exponential backoff retry
policy: the first reconnect waits initial_interval,
each subsequent attempt multiplies by factor, and the delay
is clamped to max_interval. The backoff resets after
any successful reopen.
Fields§
§initial_interval: DurationDelay before the first reconnect attempt.
max_interval: DurationCeiling applied to every reconnect delay.
factor: f64Multiplier applied to the delay after each failed attempt.
max_retries: Option<usize>Maximum number of consecutive reconnect attempts before the stream ends.
None (the default) retries indefinitely, which is what a long-lived
subscription usually wants. Note that the initial connect counts as a
reconnect here: with None, a server that is unreachable from the start
is retried forever, so the stream never yields an Err and a bare
next() loop hangs. Set a bound if you need an unreachable server to
surface as a terminal Err rather than silence.
Trait Implementations§
Source§impl Clone for RetryConfig
impl Clone for RetryConfig
Source§fn clone(&self) -> RetryConfig
fn clone(&self) -> RetryConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more