Skip to content

Commit

Permalink
chore: better atomic using
Browse files Browse the repository at this point in the history
  • Loading branch information
wwqgtxx committed Oct 2, 2024
1 parent ecd8fac commit 990de84
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tunnel/statistic/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,8 @@ func (m *Manager) handle() {
ticker := time.NewTicker(time.Second)

for range ticker.C {
m.uploadBlip.Store(m.uploadTemp.Load())
m.uploadTemp.Store(0)
m.downloadBlip.Store(m.downloadTemp.Load())
m.downloadTemp.Store(0)
m.uploadBlip.Store(m.uploadTemp.Swap(0))
m.downloadBlip.Store(m.downloadTemp.Swap(0))
}
}

Expand Down

0 comments on commit 990de84

Please sign in to comment.