Some fixes

This commit is contained in:
jpirnay
2026-05-20 20:56:03 +02:00
parent d729201321
commit c5b8c55c04
13 changed files with 52 additions and 20 deletions
+8 -2
View File
@@ -53,7 +53,10 @@ void ReadingSessionTracker::markFinished() {
if (!active) return;
const int64_t walltime = HalClock::isSynced() ? static_cast<int64_t>(HalClock::now()) : 0;
READING_STATS.markFinished(docId, title, author, static_cast<time_t>(walltime));
READING_STATS.saveToFile();
if (!READING_STATS.saveToFile()) {
LOG_ERR("RST", "saveToFile failed (markFinished) doc=%s title=%s author=%s wall=%lld", docId.c_str(), title.c_str(),
author.c_str(), (long long)walltime);
}
LOG_DBG("RST", "Marked finished doc=%s wall=%lld", docId.c_str(), (long long)walltime);
}
@@ -77,7 +80,10 @@ void ReadingSessionTracker::end() {
if (seconds > 0 && !docId.empty()) {
READING_STATS.recordSession(docId, title, author, seconds, pagesTurnedThisSession, lastKnownProgress,
static_cast<time_t>(walltime));
READING_STATS.saveToFile();
if (!READING_STATS.saveToFile()) {
LOG_ERR("RST", "saveToFile failed (session end) doc=%s title=%s author=%s secs=%u pages=%u wall=%lld",
docId.c_str(), title.c_str(), author.c_str(), seconds, pagesTurnedThisSession, (long long)walltime);
}
}
active = false;