chore: better atomic using

This commit is contained in:
wwqgtxx 2024-10-02 14:34:38 +08:00
parent ecd8facd81
commit 990de84391

View File

@ -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))
}
}