From 73c3bf809140592d7314a52c7b808cd30fe394d2 Mon Sep 17 00:00:00 2001 From: ayanami Date: Sun, 10 Nov 2024 01:02:52 +0800 Subject: [PATCH] fix: fix bug in SaveStatistic --- middleware/statistic.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/middleware/statistic.go b/middleware/statistic.go index 8a06e44..3694ac1 100644 --- a/middleware/statistic.go +++ b/middleware/statistic.go @@ -219,7 +219,11 @@ func SaveStatistic() { // 4. save dau item log.Printf("today: %s", today) log.Printf("pv: %d, uv: %d", curPVCount, curUVCount) - log.Printf("uv data(first 10): %v", curUVData.ToArray()[:10]) + if curUVCount >= 10 { + log.Printf("uv data(first 10): %v", curUVData.ToArray()[:10]) + } else { + log.Printf("uv data: %v", curUVData.ToArray()) + } // TODO: save uv, pv, dau to db