Skip to content

Commit

Permalink
switch to fastrand
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreymeng committed Nov 14, 2024
1 parent 2027bcb commit 04bc9ae
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 83 deletions.
85 changes: 4 additions & 81 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ edition = "2021"
[dependencies]
tokio = { version = "1.24.2", features = ["time"] }
tracing = "0.1.32"
rand = "0.8.5"
fastrand = "2.2.0"

[dev-dependencies]
tokio = { version = "1.24.2", features = ["rt", "macros", "test-util"] }
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl Retry {
fn apply_jitter(&self, delay: Duration) -> Duration {
if self.enable_jitter {
// [0.5, 1.0)
delay.mul_f64(0.5 + rand::random::<f64>() / 2.0)
delay.mul_f64(0.5 + fastrand::f64() / 2.0)
} else {
delay
}
Expand Down

0 comments on commit 04bc9ae

Please sign in to comment.