perf(notifications): respect server-recommended poll interval - #3116
Merged
Conversation
|
setchy
approved these changes
Jul 29, 2026
setchy
reviewed
Jul 29, 2026
setchy
self-requested a review
July 29, 2026 16:45
setchy
approved these changes
Jul 29, 2026
This was referenced Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes part of #3101
Problem
Polling uses only the user-configured
fetchIntervaland ignores theX-Poll-Intervalheader GitHub returns on the notifications list endpoint. The header advertises the minimum poll spacing the server currently wants (normally60, raised when GitHub asks clients to back off), so Gitify keeps polling at the configured rate even when the server requests slower polling.Change
pollIntervalregistry (src/renderer/utils/notifications/pollInterval.ts): forge clients report the latest server-recommended interval per account, andcomputeRefetchIntervalMsreturns the user interval stretched to the slowest recommendation across the currently polled accounts.X-Poll-Intervalfrom both the single-page and paginated notifications list fetches.useNotificationspassesrefetchIntervalas a function, so TanStack Query re-evaluates the interval after every fetch and picks up server changes without a query-key change.Forges that do not send the header never report, and polling falls back to the user interval unchanged. With the default 60s fetch interval and GitHub's normal
X-Poll-Interval: 60this is behavior-neutral; polling only slows when GitHub asks for more spacing (or when a user configures an interval below the server minimum).Tests
pollInterval.test.ts: stretch-to-slowest semantics, never faster than the user interval, ignoring intervals from accounts no longer polled, ignoring invalid values.client.test.ts: header capture on both the single-page and paginated fetch paths.