Ensure activitytracker updates get flushed to disk
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "KOReaderCredentialStore.h"
|
||||
#include "MappedInputManager.h"
|
||||
#include "OpdsServerStore.h"
|
||||
#include "ReadingSessionTracker.h"
|
||||
#include "ReadingStats.h"
|
||||
#include "RecentBooksStore.h"
|
||||
#include "SdCardFontSystem.h"
|
||||
@@ -154,6 +155,9 @@ static bool deepSleepInProgress = false;
|
||||
|
||||
void silentRestart() {
|
||||
if (deepSleepInProgress) return; // sleeping supersedes the heap-defrag reboot
|
||||
// ESP.restart() bypasses activity onExit(), so flush any in-flight reading
|
||||
// session manually — otherwise a heap-defrag reboot mid-read loses the session.
|
||||
globalReadingSessionTracker().end();
|
||||
silentRebootTarget = SILENT_REBOOT_TARGET_HOME;
|
||||
silentRebootMagic = SILENT_REBOOT_MAGIC;
|
||||
LOG_DBG("MAIN", "Silent restart (target=home)");
|
||||
@@ -163,6 +167,7 @@ void silentRestart() {
|
||||
|
||||
void silentRestartToReader() {
|
||||
if (deepSleepInProgress) return; // sleeping supersedes the heap-defrag reboot
|
||||
globalReadingSessionTracker().end();
|
||||
silentRebootTarget = SILENT_REBOOT_TARGET_READER;
|
||||
silentRebootMagic = SILENT_REBOOT_MAGIC;
|
||||
LOG_DBG("MAIN", "Silent restart (target=reader)");
|
||||
|
||||
Reference in New Issue
Block a user