1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-09-15 17:46:55 +00:00

at least pretend to make Statistics thread-safe

reduce websocket read buffers
This commit is contained in:
Kane York 2017-09-15 15:55:42 -07:00
parent 443a658af2
commit e725dc248c
2 changed files with 6 additions and 1 deletions

View file

@ -12,6 +12,8 @@ import (
)
type StatsData struct {
updateMu sync.Mutex
StatsDataVersion int
StartTime time.Time
@ -114,6 +116,9 @@ func SetBuildStamp(buildTime, buildHash string) {
}
func updateStatsIfNeeded() {
Statistics.updateMu.Lock()
defer Statistics.updateMu.Unlock()
if time.Now().Add(-2 * time.Second).After(Statistics.CachedStatsLastUpdate) {
updatePeriodicStats()
}