pub struct RetryPolicy {
pub max_retries: u32,
pub retry_delay_ms: u64,
pub deadline: Option<Duration>,
}Expand description
How hard to retry, and for how long overall.
use dataflow_rs::RetryPolicy;
use std::time::Duration;
// Three retries, 100ms doubling, but never more than 5s in total.
let policy = RetryPolicy {
max_retries: 3,
retry_delay_ms: 100,
deadline: Some(Duration::from_secs(5)),
};
assert_eq!(policy.max_retries, 3);Fields§
§max_retries: u32Retries after the first attempt. 0 means try once and give up.
retry_delay_ms: u64Base delay. Doubles per attempt, capped at 60s.
deadline: Option<Duration>Wall-clock ceiling for the whole loop, sleeps included.
Without this, a call with a 30s per-attempt timeout and capped backoff can run to roughly 127s under a 30s caller budget — the per-attempt bound says nothing about the total.
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for RetryPolicy
Source§impl Debug for RetryPolicy
impl Debug for RetryPolicy
Source§impl Default for RetryPolicy
impl Default for RetryPolicy
impl Eq for RetryPolicy
Source§impl PartialEq for RetryPolicy
impl PartialEq for RetryPolicy
impl StructuralPartialEq for RetryPolicy
Auto 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