Skip to content

Commit

Permalink
chore(distribute): address rand breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cratelyn committed Jan 28, 2025
1 parent 39283dc commit b16e876
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions linkerd/distribute/src/service/random.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{keys::KeyId, WeightedServiceKeys};
use ahash::HashMap;
use linkerd_stack::{NewService, Service};
use rand::{distributions::WeightedError, rngs::SmallRng, SeedableRng};
use rand::{rngs::SmallRng, SeedableRng};
use std::{
hash::Hash,
sync::Arc,
Expand All @@ -21,7 +21,7 @@ pub(crate) struct RandomAvailableSelection<K, S> {
}

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

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

0 comments on commit b16e876

Please # to comment.