pub struct RetryPolicy {
pub max_attempts: u32,
pub backoff: Backoff,
}Expand description
Retry configuration attached to a queue or a job.
Fields§
§max_attempts: u32Total attempts including the first. 1 means no retries.
backoff: BackoffHow long to wait before each retry.
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub fn new(max_attempts: u32, backoff: Backoff) -> Self
pub fn new(max_attempts: u32, backoff: Backoff) -> Self
A policy allowing max_attempts total attempts with the given backoff.
Sourcepub fn exponential(max_attempts: u32) -> Self
pub fn exponential(max_attempts: u32) -> Self
max_attempts attempts with the default exponential backoff.
Sourcepub fn fixed(max_attempts: u32, delay: Duration) -> Self
pub fn fixed(max_attempts: u32, delay: Duration) -> Self
max_attempts attempts with a constant delay between them.
Sourcepub fn decide(&self, failed_attempt: u32) -> RetryDecision
pub fn decide(&self, failed_attempt: u32) -> RetryDecision
Decide what to do after failed_attempt (1-based) failed.
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 moreSource§impl Debug for RetryPolicy
impl Debug for RetryPolicy
Source§impl<'de> Deserialize<'de> for RetryPolicy
impl<'de> Deserialize<'de> for RetryPolicy
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 RetryPolicy
impl PartialEq for RetryPolicy
Source§impl Serialize for RetryPolicy
impl Serialize 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