From 199503043d2a5d8b448e2dd733cf846847c14730 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 11 Nov 2026 16:35:32 +0000 Subject: [PATCH] perf: skip the plugin sleep event setup when plugins are off enterDeepSleep() took the render lock, read the battery and copied the book path for pluginevents::prepareSleep() before that function returned on plugins off. Gate the block at the call site. The readers' progress save in preparePluginSleep() and trustedtime::note() (the clock floor restored at every cold boot) still run. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01QrEdpxLkuVrifx7ahhZV13 --- src/main.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index ae78d9ce5..a926cc361 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2060,8 +2060,9 @@ void enterDeepSleep(bool fromTimeout, bool powerOff) { // Commit to sleeping before goToSleep() runs the outgoing activity's onExit(): // a WiFi activity would otherwise silentRestart() here and reboot instead. deepSleepInProgress = true; - activityManager.preparePluginSleep(); - { + activityManager.preparePluginSleep(); // also the readers' progress save: runs with plugins off + // Plugins off: skip the render lock wait, battery read and book path copy that only feed the SleepEnter event. + if (SETTINGS.pluginsEnabled) { RenderLock lock; const std::string book = activityManager.getCurrentBookPath(); pluginevents::prepareSleep(book.c_str(), activityManager.getScreenshotInfo().progressPercent,