Skip to content

perf: skip the plugin sleep event setup when plugins are off - #625

Merged
prokrypt merged 1 commit into
mainfrom
fix/plugins-off-sleep-skip
Nov 11, 2026
Merged

prokrypt merged 1 commit into
mainfrom
fix/plugins-off-sleep-skip

Conversation

@prokrypt

Copy link
Copy Markdown
Owner

Requested by Clankmaster · project thread

Review finding (plugins port): every sleep took the render lock, read the battery and copied the book path for pluginevents::prepareSleep() before that function returned on plugins off; and trustedtime::note() does an NVS read plus a write when the clock moved 60 s, plugins on or off.

Fix: enterDeepSleep() gates the SleepEnter block on SETTINGS.pluginsEnabled. Saves a render-lock wait (can block on an in-flight frame), a gauge read and a string copy per sleep with plugins off.

Left as is, with reasons:

  • activityManager.preparePluginSleep(): despite the name it runs the readers' progress save, so it must run with plugins off (comment added).
  • trustedtime::note(): it persists the clock floor that trustedtime::init() restores at every cold boot, so the clock keeps moving forward after power loss for everyone, not only plugins. One small NVS write per sleep once the clock moved 60 s.

Hardware check: X4 Pro, plugins off, read a book, sleep and wake: book reopens at the same page (progress saved). Plugins on: SleepEnter still fires.

No changelog: internal sleep-path trim, no user-visible change.


Generated by Claude Code

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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QrEdpxLkuVrifx7ahhZV13
@prokrypt
prokrypt enabled auto-merge (squash) November 11, 2026 17:50
@prokrypt prokrypt self-assigned this Nov 11, 2026
@prokrypt
prokrypt merged commit 05bd8cf into main Nov 11, 2026
17 checks passed
@prokrypt
prokrypt deleted the fix/plugins-off-sleep-skip branch November 11, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants