fix(poll): removes ETag from events poll#101
Merged
Merged
Conversation
ETag removal: GitHub's server-side cache returns stale 304s for 10+ minutes, preventing background change detection. Removes If-None-Match headers and relies on _lastEventId numeric comparison against full 200 responses instead (60 req/hr, 1.2% of rate limit budget). _lastEventId fix: uses max ID via reduce instead of assuming allEvents[0] is newest, preventing redundant targeted refreshes when events arrive out of order. Pagination: fetches up to 3 pages when page 1 is full, with early-exit optimization that skips deeper pages when the current page contains events at or below the _lastEventId threshold (events are newest-first). Adds 7 pagination tests covering full-page trigger, partial-page stop, 3-page cap, early-exit, straddling threshold, error handling, and empty-page termination.
81c35c9 to
87a2cd4
Compare
Wraps all parseInt(id, 10) calls in eventIdNum() helper that returns 0 for non-numeric IDs. Prevents _lastEventId from becoming 'NaN' if GitHub ever returned a non-numeric event ID, which would permanently break change detection until the next full refresh.
Replaces stale ETag/304 description with accurate behavior: ID-based change detection, ~1% rate-limit cost per cycle, automatic pagination up to 3 pages for high-activity users.
b806249 to
3e640c5
Compare
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.
Summary