Skip to content

Commit

Permalink
tweak select
Browse files Browse the repository at this point in the history
  • Loading branch information
myleshorton committed Nov 22, 2024
1 parent fef9cd5 commit 00339e0
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions dialer/fastconnect.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,14 @@ func (fcd *fastConnectDialer) connectAll(dialers []ProxyDialer) {
// Loop until we're connected
if len(fcd.connected.dialers) < 2 {
fcd.parallelDial(dialers)
// Add jitter to avoid thundering herd
time.Sleep(time.Duration(rand.Intn(4000)) * time.Millisecond)
} else {
break
}
select {
case <-fcd.stopCh:
log.Debug("Stopping parallel dialing")
return
default:

case <-time.After(time.Duration(rand.Intn(4000)) * time.Millisecond):
}
}
// At this point, we've tried all of the dialers, and they've all either
Expand Down

0 comments on commit 00339e0

Please sign in to comment.