Reduce GitHub API consumption to avoid rate-limit outages
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 37
- Forks
- 10
- Avg merge
- 5d 4m
- Merged PRs (30d)
- 1
Description
Background
On 2026-06-17, shortly after deploying #463, Pulldasher went down with:
GET /orgs/iFixit/members/danielbeardsley - 403
Request quota exhausted for request GET /orgs/{org}/members/{username}
Root cause
The org-membership 403 is a symptom, not the cause. That call lives only in lib/authentication.js on the login callback — it failed because the whole hourly REST quota was already drained, so login couldn't complete (app appears "down").
What drained the quota was the deploy restart. On boot, app.js runs refresh.openPulls(), sending every open pull (across all repos) through git-manager.parse(). Each parse() is ~8–15 REST requests:
| call | cost |
|---|---|
getReviews, getIssueComments, getPullReviewComments, getIssueEvents |
paginated, 1+ each |
getIssue, getCommit, getCombinedStatusForRef |
1 each |
getAllJobRuns |
1 for workflow runs + 1 per workflow run for jobs |
N open pulls × ~10 calls, back-to-back, blew the 5000/hr quota. Any restart can trigger this; #463 was simply the deploy that tipped it over. #463's own code (models/signature.js parseReview) adds zero API calls.
Proposed paths (ranked)
- ETag conditional requests — a conditional request returning
304 Not Modified(If-None-Match+Authorization) does not count against the primary rate limit (docs). Octokit does not cache by default. On restart almost every open pull is unchanged, so a per-URL ETag cache turns the startup resync from thousands of billed calls into ~0. Smallest change, biggest win. Draft PR incoming. - Trim
getAllJobRuns— heaviest per-pull cost (workflow runs + one jobs call per run) and overlapsgetCombinedStatusForRef. Switch to the Checks API or drop the job-level fetch and lean on thecheck_runwebhook. - Don't full-resync on boot — pulls are already warmed from the DB (
app.js:61-69); gate or pace therefresh.openPulls()cold-start spike. - Targeted webhook handling —
issue_commentedited/deleted andpull_request_reviewedited/dismissed do a full ~10-callparse. Handle incrementally (e.g. a dismissed approval just invalidates its CR signature bycomment_id). - GraphQL batch — one query replaces ~8 REST calls per pull. Bigger lift; only if 1–4 fall short.
Minor: cache the login org-membership check (short TTL) so an exhausted quota doesn't lock everyone out of the dashboard.
Ask
Aligning on the path forward. Starting with #1 as a draft to evaluate.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading app.js:61-69 and tracing refresh.openPulls() into git-manager.parse(), then inspect the REST calls listed in the issue and lib/authentication.js. Compare the proposed ETag approach with the incoming draft PR and measure whether restart and webhook refreshes avoid exhausting the GitHub API quota without breaking pull refresh or login.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, typescript
- Domain
- api, backend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100