Skip to content

Commit

Permalink
docs: mention sleep() in blocking retry examples (#143)
Browse files Browse the repository at this point in the history
### What does this PR do

Based on the
[discussion](#131 (comment)),
mention `sleep()` in the blocking retry examples.

Added to examples in both `README.md` and `lib.rs`.
  • Loading branch information
SteveLauC authored Sep 4, 2024
1 parent a379d62 commit 34c8e56
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ fn main() -> Result<()> {
let content = fetch
// Retry with exponential backoff
.retry(ExponentialBuilder::default())
// Sleep implementation, required if no feature has been enabled
.sleep(std::thread::sleep)
// When to retry
.when(|e| e.to_string() == "EOF")
// Notify when retrying
Expand Down
2 changes: 2 additions & 0 deletions backon/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@
//! let content = fetch
//! // Retry with exponential backoff
//! .retry(ExponentialBuilder::default())
//! // Sleep implementation, default to std::thread::sleep if `std-blocking-sleep` has been enabled.
//! .sleep(std::thread::sleep)
//! // When to retry
//! .when(|e| e.to_string() == "EOF")
//! // Notify when retrying
Expand Down

0 comments on commit 34c8e56

Please sign in to comment.