From fc45645280fbcbd4acf657b8018392e602a238ca Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Thu, 24 Sep 2020 19:38:24 -0700 Subject: [PATCH] Reset session stats when we cleanup the session. Closes #180 --- core/core.go | 2 ++ core/status.go | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/core/core.go b/core/core.go index 01de48da3..be3fd4e04 100644 --- a/core/core.go +++ b/core/core.go @@ -64,6 +64,8 @@ func startCleanupTimer() { for { select { case <-_cleanupTimer.C: + // Reset the session count since the session is over + _stats.SessionMaxViewerCount = 0 resetDirectories() ffmpeg.ShowStreamOfflineState() } diff --git a/core/status.go b/core/status.go index c512915f0..cd720667c 100644 --- a/core/status.go +++ b/core/status.go @@ -33,11 +33,6 @@ func SetStreamAsConnected() { _stats.LastConnectTime = utils.NullTime{time.Now(), true} _stats.LastDisconnectTime = utils.NullTime{time.Now(), false} - timeSinceDisconnect := time.Since(_stats.LastDisconnectTime.Time).Minutes() - if timeSinceDisconnect > 15 { - _stats.SessionMaxViewerCount = 0 - } - chunkPath := config.Config.GetPublicHLSSavePath() if usingExternalStorage { chunkPath = config.Config.GetPrivateHLSSavePath()