Skip to content

Commit

Permalink
Fix panic in Uniform
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedilger committed Jun 29, 2024
1 parent ca98995 commit a1fa061
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions gossip-lib/src/overlord/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,13 +526,15 @@ impl Overlord {
&mut self,
url: RelayUrl,
jobs: Vec<RelayJob>,
exclusion: u64,
mut exclusion: u64,
) {
// Randomize the exclusion to between half and full
use rand::Rng;
let exclusion = rand::thread_rng().sample(
rand::distributions::Uniform::new(exclusion/2, exclusion)
);
if exclusion > 1 {
exclusion = rand::thread_rng().sample(
rand::distributions::Uniform::new(exclusion/2, exclusion)
);
}

// Let the relay picker know it disconnected
GLOBALS
Expand Down

0 comments on commit a1fa061

Please sign in to comment.