[][src]Struct again::RetryPolicy

pub struct RetryPolicy { /* fields omitted */ }

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]

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]

Retries a fallible Future with this policy's configuration under certain provided conditions

Trait Implementations

impl Clone for RetryPolicy[src]

impl Default for RetryPolicy[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,