Fix potential concurrent access condition

This commit is contained in:
Gabe Kangas 2021-07-22 15:26:19 -07:00
parent 3c6fcb0de5
commit f782e82909

View File

@ -100,6 +100,9 @@ func SetViewerIdActive(id string) {
func pruneViewerCount() {
viewers := make(map[string]time.Time)
l.Lock()
defer l.Unlock()
for viewerId := range _stats.Viewers {
viewerLastSeenTime := _stats.Viewers[viewerId]
if time.Since(viewerLastSeenTime) < _activeViewerPurgeTimeout {