Skip to content

feat: pause polling while locked or suspended - #3590

Merged
setchy merged 3 commits into
mainfrom
feat/power-aware-polling
Nov 1, 2026
Merged

setchy merged 3 commits into
mainfrom
feat/power-aware-polling

Conversation

@setchy

@setchy setchy commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Summary

Part of OpenSpec change 04-clean-up-dependencies-and-electron-debt (tasks 3.1–3.5 and 6.1).

  • Emit a new SYSTEM_SLEEP event from powerMonitor suspend and lock-screen; keep the existing SYSTEM_WAKE events on resume and unlock-screen.
  • Add a session-local usePowerStateStore and a usePowerState subscription mounted in GlobalEffects.
  • Gate notification and account refetchIntervals on the power state.
  • Wake/unlock resumes polling with an immediate refetch; duplicate wake events use refetch({ cancelRefetch: false }) so they share the in-flight fetch.
  • Document the session power state and polling behavior in ARCHITECTURE.md.

Polling behavior

  • Hidden or unfocused window: polling continues; refetchIntervalInBackground keeps the timers running.
  • Offline: notification and account queries pause (networkMode: 'online'), and the notifications screen shows the offline state; on reconnect they resume, and the online state is re-probed on wake.
  • Locked or suspended: SYSTEM_SLEEP disables the query intervals; SYSTEM_WAKE re-enables them and triggers an immediate refetch of the notification and account queries (cancelRefetch: false) before the normal intervals resume.

Verification

  • pnpm check passes.
  • Targeted tests pass: main power events (12), preload (14), power store/hook, GlobalEffects (9), account polling, and notification polling (71 across the affected renderer files).

Notes

Draft for review. Based on main; #3587 has merged, and #3588 still touches the same events/preload/system-handler area, so expect a small conflict if #3588 lands first.

Emit SYSTEM_SLEEP from powerMonitor suspend and lock-screen events, track a session power state in Zustand, and gate notification and account refetch intervals on it. Wake and unlock resume polling with one immediate refetch; duplicate wake events share the in-flight fetch.
@github-actions github-actions Bot added the enhancement New feature or enhancement to existing functionality label Nov 1, 2026
@setchy
setchy marked this pull request as ready for review November 1, 2026 21:31
@setchy
setchy requested a review from afonsojramos as a code owner November 1, 2026 21:31
Spell out hidden-window, offline, and lock/suspend behavior instead of saying the previous behavior is unchanged.
@setchy
setchy merged commit cce9aad into main Nov 1, 2026
18 checks passed
@setchy
setchy deleted the feat/power-aware-polling branch November 1, 2026 21:36
@github-actions github-actions Bot added this to the Release 8.0.0 milestone Nov 1, 2026
@sonarqubecloud

sonarqubecloud Bot commented Nov 1, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in Gitify v8.0.0! 🎉

Downloads for macOS, Windows, and Linux are available on the release page.

Thanks for helping make Gitify better!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or enhancement to existing functionality

Development

Successfully merging this pull request may close these issues.

1 participant