Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

Fix potential concurrent access condition

Gabe Kangas791ed96fb8de
diff --git a/core/stats.go b/core/stats.go
index 639de1bc2a..b2a3fbda12 100644
--- a/core/stats.go
+++ b/core/stats.go
@@ -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 {