Skip to content

Commit

Permalink
Add jitter to default-features
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonqn committed Sep 26, 2021
1 parent 7473422 commit c2f16ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 1 addition & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,4 @@ tokio = { version = "1", features = [ "time", "rt" ], default-features = false }
reqwest = "0.11"

[features]
default = [ "tokio" ]

[package.metadata.docs.rs]
features = ["rand", "tokio"]
default = [ "tokio", "rand" ]
7 changes: 4 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
//! # }
//! ```
//! ## Sequential retry with backoff.
//! Retries failed requests with an exponential backoff.
//! Retries failed requests with an exponential backoff and a jitter.
//! ```
//! # async fn run() -> Result<(), reqwest::Error> {
//! use fure::{policies::{backoff, cond}, backoff::exponential};
//! use fure::{policies::{backoff, cond}, backoff::{exponential, jitter}};
//! use std::time::Duration;
//!
//! let get_body = || async {
Expand All @@ -44,7 +44,8 @@
//! .text()
//! .await
//! };
//! let exp_backoff = exponential(Duration::from_secs(1), 2, Some(Duration::from_secs(10)));
//! let exp_backoff = exponential(Duration::from_secs(1), 2, Some(Duration::from_secs(10)))
//! .map(jitter);
//! let policy = cond(backoff(exp_backoff), |result| !matches!(result, Some(Ok(_))));
//! let body = fure::retry(get_body, policy).await?;
//! println!("body = {}", body);
Expand Down

0 comments on commit c2f16ff

Please sign in to comment.