Skip to content

Commit a472f56

Browse files
committed
remove wg
1 parent f30bd12 commit a472f56

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

vpn/tunnel.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ func (u *updater) netStatusLoop() {
607607
case <-u.ctx.Done():
608608
return
609609
case <-ticker.C:
610-
go u.recordLatency()
610+
u.recordLatency()
611611
u.sendAgentUpdate()
612612
}
613613
}
@@ -623,11 +623,8 @@ func (u *updater) recordLatency() {
623623

624624
pingCtx, cancelFunc := context.WithTimeout(u.ctx, 5*time.Second)
625625
defer cancelFunc()
626-
var wg sync.WaitGroup
627626
for _, agentID := range agentsIDsToPing {
628-
wg.Add(1)
629627
go func() {
630-
defer wg.Done()
631628
pingDur, didP2p, pingResult, err := u.conn.Ping(pingCtx, agentID)
632629
if err != nil {
633630
u.logger.Warn(u.ctx, "failed to ping agent", slog.F("agent_id", agentID), slog.Error(err))
@@ -658,7 +655,6 @@ func (u *updater) recordLatency() {
658655
}
659656
}()
660657
}
661-
wg.Wait()
662658
}
663659

664660
// processSnapshotUpdate handles the logic when a full state update is received.

0 commit comments

Comments
 (0)