Skip to content

Commit

Permalink
defer wg.Done
Browse files Browse the repository at this point in the history
Co-authored-by: Vegar Sechmann Molvig <[email protected]>
  • Loading branch information
mortenlj and sechmann committed Dec 22, 2023
1 parent febc0fe commit 78e00b1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/device-agent/states/connected/connected.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ func (c *Connected) launchHealthCheck(ctx context.Context) context.CancelFunc {
for i, gw := range gateways {
wg.Add(1)
go func(i int, gw *pb.Gateway) {
defer wg.Done()
err := ping(c.logger, gw.Ipv4)
pos := fmt.Sprintf("[%02d/%02d]", i+1, total)
if err == nil {
Expand All @@ -290,7 +291,6 @@ func (c *Connected) launchHealthCheck(ctx context.Context) context.CancelFunc {
gw.Healthy = false
c.logger.Debugf("%s %s: unable to ping %s: %v", pos, gw.Name, gw.Ipv4, err)
}
wg.Done()
}(i, gw)
}
wg.Wait()
Expand Down

0 comments on commit 78e00b1

Please sign in to comment.