pub struct RetryPolicy {
pub max_attempts: u32,
pub base_delay: Duration,
pub max_delay: Duration,
pub jitter_ratio: f64,
}Expand description
Strategy for retrying transient failures with exponential backoff.
Fields§
§max_attempts: u32Maximum attempts including the first request.
base_delay: DurationBase delay for the first retry.
max_delay: DurationMaximum delay cap for later retries.
jitter_ratio: f64Jitter ratio (0.0..=1.0) applied to delay.
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub fn http_default() -> Self
pub fn http_default() -> Self
Default policy for outbound HTTP provider requests.
Sourcepub fn backoff_delay(&self, retry_index: u32) -> Duration
pub fn backoff_delay(&self, retry_index: u32) -> Duration
Exponential backoff delay for the given retry index (1-based).
Sourcepub fn with_jitter(&self, delay: Duration) -> Duration
pub fn with_jitter(&self, delay: Duration) -> Duration
Apply jitter to a delay using a symmetric random range.
Trait Implementations§
Source§impl Clone for RetryPolicy
impl Clone for RetryPolicy
Source§fn clone(&self) -> RetryPolicy
fn clone(&self) -> RetryPolicy
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 moreAuto Trait Implementations§
impl Freeze for RetryPolicy
impl RefUnwindSafe for RetryPolicy
impl Send for RetryPolicy
impl Sync for RetryPolicy
impl Unpin for RetryPolicy
impl UnsafeUnpin for RetryPolicy
impl UnwindSafe for RetryPolicy
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