pub enum RetryStrategy {
None,
Fixed {
delay_secs: u32,
},
Exponential {
base_delay_secs: u32,
max_delay_secs: u32,
multiplier: f64,
},
Linear {
initial_delay_secs: u32,
increment_secs: u32,
max_delay_secs: u32,
},
Custom {
delays: Vec<u32>,
},
}Expand description
Retry strategy for failed tasks
Variants§
None
No retry
Fixed
Fixed delay between retries
Exponential
Exponential backoff with optional jitter
Fields
Linear
Linear backoff
Fields
Custom
Custom delay for each retry attempt
Implementations§
Source§impl RetryStrategy
impl RetryStrategy
Sourcepub fn exponential(base_delay_secs: u32, max_delay_secs: u32) -> Self
pub fn exponential(base_delay_secs: u32, max_delay_secs: u32) -> Self
Create an exponential backoff retry strategy
Sourcepub fn linear(
initial_delay_secs: u32,
increment_secs: u32,
max_delay_secs: u32,
) -> Self
pub fn linear( initial_delay_secs: u32, increment_secs: u32, max_delay_secs: u32, ) -> Self
Create a linear backoff retry strategy
Sourcepub fn calculate_delay(&self, retry_count: u32) -> Option<Duration>
pub fn calculate_delay(&self, retry_count: u32) -> Option<Duration>
Calculate the delay for a specific retry attempt
Trait Implementations§
Source§impl Clone for RetryStrategy
impl Clone for RetryStrategy
Source§fn clone(&self) -> RetryStrategy
fn clone(&self) -> RetryStrategy
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 RetryStrategy
impl Debug for RetryStrategy
Source§impl Default for RetryStrategy
impl Default for RetryStrategy
Source§impl<'de> Deserialize<'de> for RetryStrategy
impl<'de> Deserialize<'de> for RetryStrategy
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for RetryStrategy
impl PartialEq for RetryStrategy
Source§impl Serialize for RetryStrategy
impl Serialize for RetryStrategy
impl StructuralPartialEq for RetryStrategy
Auto Trait Implementations§
impl Freeze for RetryStrategy
impl RefUnwindSafe for RetryStrategy
impl Send for RetryStrategy
impl Sync for RetryStrategy
impl Unpin for RetryStrategy
impl UnwindSafe for RetryStrategy
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