Extensible, asynchronous retry behaviours for futures/tokio
See the codeExtensible, asynchronous retry behaviours for the ecosystem of tokio libraries.
no_std supportrand feature)use tokio_retry::Retry;
use tokio_retry::strategy::{ExponentialBackoff, jitter};
async fn action() -> Result<u64, ()> {
// do some real-world stuff here...
Err(())
}
#[tokio::main]
async fn main() -> Result<(), ()> {
let retry_strategy = ExponentialBackoff::from_millis(10)
.map(jitter) // add jitter to delays
.take(3); // limit to 3 retries
let result = Retry::start(retry_strategy, action).await?;
Ok(())
}
195 followers · starred Mar 2017
288 followers · starred Mar 2017
218 followers · starred Mar 2017
26 followers · starred Aug 2017
Extensible, asynchronous retry behaviours for futures/tokio
See the codeExtensible, asynchronous retry behaviours for the ecosystem of tokio libraries.
no_std supportrand feature)use tokio_retry::Retry;
use tokio_retry::strategy::{ExponentialBackoff, jitter};
async fn action() -> Result<u64, ()> {
// do some real-world stuff here...
Err(())
}
#[tokio::main]
async fn main() -> Result<(), ()> {
let retry_strategy = ExponentialBackoff::from_millis(10)
.map(jitter) // add jitter to delays
.take(3); // limit to 3 retries
let result = Retry::start(retry_strategy, action).await?;
Ok(())
}
195 followers · starred Mar 2017
288 followers · starred Mar 2017
218 followers · starred Mar 2017
26 followers · starred Aug 2017