tokio-retry

Extensible, asynchronous retry behaviours based on futures, for the ecosystem of tokio libraries.

crates

Documentation

Installation

Add this to your Cargo.toml:

toml [dependencies] tokio-retry = "*"

Examples

```rust extern crate futures; extern crate tokiotimer; extern crate tokioretry;

use std::time::Duration; use std::default::Default; use futures::future::Future; use tokiotimer::Timer; use tokioretry::RetryStrategy; use tokio_retry::strategies::ExponentialBackoff;

fn action() -> Result

pub fn main() { let retrystrategy = ExponentialBackoff::frommillis(10) .limitdelay(Duration::frommillis(1000)) .limitretries(3) .jitter(); let retryfuture = retrystrategy.run(Timer::default(), action); let retryresult = retry_future.wait();

asserteq!(retryresult, Ok(42)); } ```