Skip to content

Commit 00ace22

Browse files
committed
chore(exp-backoff): address rand breaking changes
Signed-off-by: katelyn martin <[email protected]>
1 parent 3c823cf commit 00ace22

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

linkerd/exp-backoff/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
use futures::Stream;
55
use pin_project::pin_project;
6-
use rand::{rngs::SmallRng, thread_rng, SeedableRng};
6+
use rand::{rngs::SmallRng, SeedableRng};
77
use std::future::Future;
88
use std::pin::Pin;
99
use std::task::{Context, Poll};
@@ -74,7 +74,7 @@ impl ExponentialBackoff {
7474
pub fn stream(&self) -> ExponentialBackoffStream {
7575
ExponentialBackoffStream {
7676
backoff: *self,
77-
rng: SmallRng::from_rng(&mut thread_rng()).expect("RNG must be valid"),
77+
rng: SmallRng::from_rng(&mut rand::rng()),
7878
iterations: 0,
7979
sleeping: false,
8080
sleep: Box::pin(time::sleep(time::Duration::from_secs(0))),
@@ -103,7 +103,7 @@ impl ExponentialBackoff {
103103
if self.jitter == 0.0 {
104104
time::Duration::default()
105105
} else {
106-
let jitter_factor = rng.gen::<f64>();
106+
let jitter_factor = rng.random::<f64>();
107107
debug_assert!(
108108
jitter_factor > 0.0,
109109
"rng returns values between 0.0 and 1.0"

0 commit comments

Comments
 (0)