[−][src]Struct again::RetryPolicy
A template for configuring retry behavior
A default is provided, configured to retry a task 5 times with exponential backoff starting with a 1 second delay
Implementations
impl RetryPolicy
[src]
pub fn exponential(delay: Duration) -> Self
[src]
Configures policy with an exponential backoff delay.
By default, Futures will be retried 5 times.
These delays will increase in
length over time. You may wish to cap just how long
using the with_max_delay
fn
pub fn fixed(delay: Duration) -> Self
[src]
Configures policy with a fixed backoff delay.
By default, Futures will be retried 5 times.
These delays will increase in
length over time. You may wish to configure how many
times a Future will be retried using the with_max_retries
fn
pub fn with_jitter(self, jitter: bool) -> Self
[src]
Configures randomness to the delay between retries.
This is useful for services that have many clients which might all retry at the same time to avoid the "thundering herd" problem
pub fn with_max_delay(self, max: Duration) -> Self
[src]
Limits the maximum length of delay between retries
pub fn with_max_retries(self, max: usize) -> Self
[src]
Limits the maximum number of attempts a Future will be tried
pub async fn retry<'_, T>(&'_ self, task: T) -> Result<T::Item, T::Error> where
T: Task,
[src]
T: Task,
Retries a fallible Future
with this policy's configuration
pub async fn retry_if<'_, T, C>(
&'_ self,
task: T,
condition: C
) -> Result<T::Item, T::Error> where
T: Task,
C: Condition<T::Error>,
[src]
&'_ self,
task: T,
condition: C
) -> Result<T::Item, T::Error> where
T: Task,
C: Condition<T::Error>,
Retries a fallible Future
with this policy's configuration under certain provided conditions
Trait Implementations
impl Clone for RetryPolicy
[src]
fn clone(&self) -> RetryPolicy
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Default for RetryPolicy
[src]
Auto Trait Implementations
impl RefUnwindSafe for RetryPolicy
impl Send for RetryPolicy
impl Sync for RetryPolicy
impl Unpin for RetryPolicy
impl UnwindSafe for RetryPolicy
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,