From 4a4639a5237518980f3e5f12dd9ee66c2f6fc6c0 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Sat, 5 Dec 2020 15:09:57 -0800 Subject: [PATCH] Ignore old per-session peak viewer counts when reading stats file. --- core/stats.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/stats.go b/core/stats.go index ae787456a..cc017cc59 100644 --- a/core/stats.go +++ b/core/stats.go @@ -141,5 +141,11 @@ func getSavedStats() (models.Stats, error) { return result, err } + // If the stats were saved > 5min ago then ignore the + // peak session count value, since the session is over. + if !result.LastDisconnectTime.Valid || time.Since(result.LastDisconnectTime.Time).Minutes() > 5 { + result.SessionMaxViewerCount = 0 + } + return result, err }