Skip to content

feat: rate-limit detection, back off until reset#56

Merged
masonlet merged 7 commits into
mainfrom
feat/rate-limiting
Jul 13, 2026
Merged

feat: rate-limit detection, back off until reset#56
masonlet merged 7 commits into
mainfrom
feat/rate-limiting

Conversation

@masonlet

Copy link
Copy Markdown
Member

Summary

Distinguishes GitHub rate-limiting from other fetch failures. A rate-limited 403 was previously handled identically to permission-denied or network errors; same generic log, same hardcoded 5-minute stale-cache window.

Changes

  • Detect rate limiting (403/429 with X-RateLimit-Remaining: 0, or a Retry-After header) and log a distinct GitHub rate limit exceeded; resets at HH:MM:SS message once per refresh
  • Stale-cache retry now waits until the actual reset time, clamped to [60s, refresh interval]; non-rate-limit failures keep the 5-minute fallback
  • Split src/github.ts into src/github/ (fetch, parse, process, rateLimit, types) with tests mirrored
  • Fix mockErrorResponse missing a headers stub, which silently bypassed the error path in existing tests
  • Fix rateLimitReset returning 0 instead of null when the reset header is absent
  • README notes the failure/backoff behavior

@masonlet
masonlet merged commit 0fcf221 into main Jul 13, 2026
5 checks passed
@masonlet
masonlet deleted the feat/rate-limiting branch July 13, 2026 20:58
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