Skip to content

Commit 08d21d6

Browse files
authored
Make ping job workers channel buffer length same as len(servers)
Original title: changes to avoid race condition seen with ping job workers (#32) Authored-by: blnprasad <[email protected]>
1 parent 9459cbb commit 08d21d6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

speedtest/speedtest.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ func SpeedTest(c *cli.Context) error {
263263
log.Info("Selecting the fastest server based on ping")
264264

265265
var wg sync.WaitGroup
266-
jobs := make(chan PingJob, 10)
267-
results := make(chan PingResult, 10)
266+
jobs := make(chan PingJob, len(servers))
267+
results := make(chan PingResult, len(servers))
268268
done := make(chan struct{})
269269

270270
pingList := make(map[int]float64)

0 commit comments

Comments
 (0)