pub struct BackoffConfig {
pub max_retries: u32,
pub backoff_factor: Duration,
pub max_backoff: Duration,
}Expand description
Configuration for exponential backoff retries.
Fields§
§max_retries: u32Maximum number of retry attempts.
backoff_factor: DurationBase backoff duration (multiplied by 2^(attempt-1)).
max_backoff: DurationMaximum backoff duration (cap).
Implementations§
Source§impl BackoffConfig
impl BackoffConfig
Sourcepub fn delay_for_attempt(&self, attempt: u32) -> Duration
pub fn delay_for_attempt(&self, attempt: u32) -> Duration
Calculate the sleep duration for a given attempt (1-indexed).
Formula: backoff_factor * 2^(attempt - 1), capped at max_backoff.
Python: sleep_time = self.backoff_factor * (2 ** (attempt - 1))
TypeScript: STALKER_RETRY_BACKOFF_BASE_MS * Math.pow(2, attempt - 1)
Sourcepub fn should_retry(&self, attempt: u32) -> bool
pub fn should_retry(&self, attempt: u32) -> bool
Whether the given attempt (1-indexed) should be retried.
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 UnsafeUnpin 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