Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9f00ac5

Browse files
committed
Fix latest stat being reported
1 parent 1924f58 commit 9f00ac5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

agent/agent.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,6 +1276,9 @@ func (a *agent) startReportingConnectionStats(ctx context.Context) {
12761276

12771277
select {
12781278
case a.connStatsChan <- stats:
1279+
// Only store the latest stat when it's successfully sent!
1280+
// Otherwise, it should be sent again on the next iteration.
1281+
a.latestStat.Store(stats)
12791282
default:
12801283
a.logger.Warn(ctx, "network stat dropped")
12811284
}

0 commit comments

Comments
 (0)