From 7459b5572c56a9905a76580ec88d73f70afe167a Mon Sep 17 00:00:00 2001 From: jpirnay Date: Sat, 23 May 2026 23:31:11 +0200 Subject: [PATCH] No zero seconds bump --- src/ReadingStats.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ReadingStats.cpp b/src/ReadingStats.cpp index 12327ee1..a59526dc 100644 --- a/src/ReadingStats.cpp +++ b/src/ReadingStats.cpp @@ -86,8 +86,14 @@ void ReadingStatsStore::recordSession(const std::string& docId, const std::strin it->totalSeconds += sessionSeconds; it->pagesTurned += sessionPagesTurned; - it->sessions += 1; it->progress = progress; + // A zero-second call is a progress-flush from silentRestart(): we want the + // updated progress/title persisted but the session counter must not tick. + // Otherwise every heap-defrag reboot would inflate sessions by one. + if (sessionSeconds > 0) { + it->sessions += 1; + globalTotalSessions += 1; + } if (walltimeEpoch != 0) { if (it->firstReadEpoch == 0) it->firstReadEpoch = walltimeEpoch; it->lastReadEpoch = walltimeEpoch; @@ -100,7 +106,6 @@ void ReadingStatsStore::recordSession(const std::string& docId, const std::strin } globalTotalSeconds += sessionSeconds; - globalTotalSessions += 1; globalTotalPagesTurned += sessionPagesTurned; }