Skip to content

Fix: Reduce GitHub API rate limit usage by 75%#448

Merged
bborn merged 1 commit intomainfrom
task/1284-github-rate-limits-exceeded
Feb 12, 2026
Merged

Fix: Reduce GitHub API rate limit usage by 75%#448
bborn merged 1 commit intomainfrom
task/1284-github-rate-limits-exceeded

Conversation

@bborn
Copy link
Owner

@bborn bborn commented Feb 12, 2026

Summary

  • Reduced GitHub API polling from every 15 seconds to every 60 seconds
  • Increased PR info cache TTL from 15 seconds to 90 seconds
  • Added rate limit error detection and graceful handling

Problem

The UI was hitting GitHub rate limits due to aggressive polling:

  • Polled GitHub every 15 seconds
  • Made 3 API calls per repository per poll (open, merged, closed PRs)
  • 720 API calls per hour for a single repo
  • Exceeded GitHub's 60/hour unauthenticated limit in just 5 minutes
  • Used 14% of the 5,000/hour authenticated limit

Solution

API Usage Impact:

  • Before: 720 API calls/hour per repo
  • After: 180 API calls/hour per repo
  • 75% reduction in API usage

Changes:

  1. Refresh interval: 15s → 60s (4x reduction in frequency)
  2. Cache TTL: 15s → 90s (ensures cache hits between refreshes)
  3. Error handling: Detects rate limit errors and returns gracefully

Test Plan

  • Existing tests pass
  • Code compiles successfully
  • Manual testing: Run UI for extended period to verify rate limits not hit
  • Verify PR status updates still feel responsive (60s is acceptable for CI checks)

Files Changed

  • internal/github/pr.go: Increased cache TTL, added rate limit detection
  • internal/ui/app.go: Increased refresh tick interval from 15s to 60s

🤖 Generated with Claude Code

Problem: The UI was polling GitHub every 15 seconds, making 3 API calls
per repository per poll (open, merged, and closed PRs). This resulted in
720 API calls per hour for a single repo, easily exceeding GitHub's rate
limits (5,000/hour authenticated, 60/hour unauthenticated).

Changes:
1. Increased PR refresh interval from 15s to 60s (4x reduction)
2. Increased cache TTL from 15s to 90s (6x increase)
3. Added rate limit error detection and graceful handling

Impact:
- API usage reduced from 720 calls/hour to 180 calls/hour (75% reduction)
- PR information still refreshes every minute (reasonable for CI checks)
- Cache now lasts longer than refresh interval, improving efficiency
- Rate limit errors are detected and handled gracefully

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@bborn bborn merged commit 88a8c34 into main Feb 12, 2026
3 checks 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