Skip to content

fix(poll): removes ETag from events poll#101

Merged
wgordon17 merged 3 commits into
gordon-code:mainfrom
wgordon17:fix/events-poll-etag
May 4, 2026
Merged

fix(poll): removes ETag from events poll#101
wgordon17 merged 3 commits into
gordon-code:mainfrom
wgordon17:fix/events-poll-etag

Conversation

@wgordon17
Copy link
Copy Markdown
Member

@wgordon17 wgordon17 commented May 3, 2026

Summary

  • Removes ETag conditional requests from events poll — GitHub's server-side cache returns stale 304s for 10+ minutes, preventing background change detection
  • Relies on _lastEventId numeric comparison against full 200 responses instead (60 req/hr, 1.2% of rate limit budget)
  • Fixes _lastEventId advancement to use max ID via reduce, preventing redundant targeted refreshes when events arrive out of order
  • Adds pagination (up to 3 pages) with early-exit optimization that skips deeper pages when the current page contains already-seen events
  • Adds 7 pagination tests covering full-page trigger, partial-page stop, 3-page cap, early-exit, straddling threshold, error handling, and empty-page termination

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.
@wgordon17 wgordon17 force-pushed the fix/events-poll-etag branch from 81c35c9 to 87a2cd4 Compare May 4, 2026 15:19
wgordon17 added 2 commits May 4, 2026 11:30
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.
@wgordon17 wgordon17 force-pushed the fix/events-poll-etag branch from b806249 to 3e640c5 Compare May 4, 2026 15:50
@wgordon17 wgordon17 marked this pull request as ready for review May 4, 2026 15:51
@wgordon17 wgordon17 merged commit a23ab11 into gordon-code:main May 4, 2026
1 check passed
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.

1 participant