Skip to content

Commit

Permalink
fix: exponential backoff which was jumping to waiting for cap
Browse files Browse the repository at this point in the history
  • Loading branch information
hansl committed May 18, 2021
1 parent 8329d68 commit 01e9e94
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "garcon"
version = "0.2.2"
version = "0.2.3"
authors = ["Hans Larsen <[email protected]>"]
edition = "2018"
description = "A collection of trait and classes to make your thread or async function wait."
Expand Down
2 changes: 1 addition & 1 deletion src/throttle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl ExponentialBackoffWaiter {
let current = next.load(Ordering::Relaxed);

// Find the next throttle.
let next = u64::max(
let next = u64::min(
(current as f64 * self.multiplier) as u64,
self.cap_as_micros,
);
Expand Down

0 comments on commit 01e9e94

Please sign in to comment.