Skip to content

Commit

Permalink
Make ping job workers channel buffer length same as len(servers)
Browse files Browse the repository at this point in the history
Original title: changes to avoid race condition seen with ping job workers (#32)

Authored-by: blnprasad <[email protected]>
  • Loading branch information
blnprasad authored May 7, 2021
1 parent 9459cbb commit 08d21d6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions speedtest/speedtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ func SpeedTest(c *cli.Context) error {
log.Info("Selecting the fastest server based on ping")

var wg sync.WaitGroup
jobs := make(chan PingJob, 10)
results := make(chan PingResult, 10)
jobs := make(chan PingJob, len(servers))
results := make(chan PingResult, len(servers))
done := make(chan struct{})

pingList := make(map[int]float64)
Expand Down

0 comments on commit 08d21d6

Please sign in to comment.