Skip to content

Commit b16e876

Browse files
committed
chore(distribute): address rand breaking changes
see rust-random/rand#1382. in particular, this part of the change: https://github.com/rust-random/rand/pull/1382/files#diff-b0eb1b0ef894742b65e07f23af6cbeffae64ec8311adb6ea606603e978023e0cL116-R113 see also rust-random/rand#1470. Signed-off-by: katelyn martin <[email protected]>
1 parent 39283dc commit b16e876

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

linkerd/distribute/src/service/random.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::{keys::KeyId, WeightedServiceKeys};
22
use ahash::HashMap;
33
use linkerd_stack::{NewService, Service};
4-
use rand::{distributions::WeightedError, rngs::SmallRng, SeedableRng};
4+
use rand::{rngs::SmallRng, SeedableRng};
55
use std::{
66
hash::Hash,
77
sync::Arc,
@@ -21,7 +21,7 @@ pub(crate) struct RandomAvailableSelection<K, S> {
2121
}
2222

2323
fn new_rng() -> SmallRng {
24-
SmallRng::from_rng(rand::thread_rng()).expect("RNG must initialize")
24+
SmallRng::from_rng(&mut rand::rng())
2525
}
2626

2727
impl<K, S> RandomAvailableSelection<K, S> {
@@ -92,7 +92,7 @@ where
9292
// to `poll_ready` can try this backend again.
9393
match selector.disable_backend(id) {
9494
Ok(()) => {}
95-
Err(WeightedError::AllWeightsZero) => {
95+
Err(rand::distr::weighted::Error::InsufficientNonZero) => {
9696
// There are no backends remaining.
9797
break;
9898
}

0 commit comments

Comments
 (0)