#[non_exhaustive]pub struct Backoff {
pub initial: Duration,
pub multiplier: u32,
pub max: Duration,
pub timeout: Duration,
}Expand description
Exponential backoff configuration for reconnection attempts.
This decides how long to wait between reconnect attempts and when to give up. The delays carry jitter, so a fleet knocked offline together doesn’t reconnect in lockstep.
timeout is what ends a hopeless loop: every failure rides the same backoff,
and the short default budget is what surfaces a broken target instead of hiding it. The only
failures short-circuited are answers a server actually gave (an auth rejection, or a CONNECT
status that isn’t an invitation to retry). A zero timeout removes the backstop, so it belongs
only where an unattended process must outlive an outage of any length.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.initial: DurationInitial delay before first reconnect attempt.
multiplier: u32Multiplier applied to delay after each failure.
max: DurationMaximum delay between reconnect attempts.
timeout: DurationMaximum time to spend retrying before giving up. Resets after a stable connection (one that outlives the initial backoff), so a flapping session that reconnects then immediately drops still counts toward the timeout. Set to 0 for unlimited retries.
Implementations§
Source§impl Backoff
impl Backoff
Sourcepub fn linger(&self) -> Duration
pub fn linger(&self) -> Duration
How long broadcasts fed by a reconnecting session should outlive a session
drop (see moq_net::origin::Info::linger): slightly past the give-up
timeout, so when the loop does give up its error surfaces
before the broadcasts tear down. A zero timeout retries forever, so the
broadcasts linger forever too.
Trait Implementations§
Source§impl Args for Backoff
impl Args for Backoff
Source§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
Source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
Command so it can instantiate self via
FromArgMatches::update_from_arg_matches_mut Read moreSource§impl<'de> Deserialize<'de> for Backoff
impl<'de> Deserialize<'de> for Backoff
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl FromArgMatches for Backoff
impl FromArgMatches for Backoff
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches to self.