perf: fetch merged PRs via GraphQL (different rate-limit bucket)#5
Merged
Conversation
The merged-PR pagination was the rate-limit bottleneck — up to 10 search calls per cold-start, multiplied by 4 widget endpoints = 40 search calls in a cold-start cluster, blowing through GitHub's 30/min REST search bucket. GraphQL search runs against the 5000/hour points bucket instead. At ~1 point per page, 4 widgets × 10 pages = 40 points. Plenty of headroom. Star counts also come back inline via repository.stargazerCount, so the card/recent/ top-repos transforms no longer need separate getStarsForRepos roundtrips. Open and closed-unmerged counts still use REST search (1 call each, well within the 30/min budget). Touches: - github-data.ts: paginateMergedPRsGraphQL replaces paginateSearch - ContributionData adds repoStars: Record<string, number> populated inline - card/recent/top-repos endpoints filter by data.repoStars instead of fetching stars separately
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
Closes the rate-limit risk introduced by #1's pagination fix.
The merged-PR pagination was hitting GitHub's 30/min REST search bucket: up to 10 search calls per cold-start × 4 widget endpoints = 40 search calls in a cold-start cluster. Each cold-start storm reliably tripped 429s in production.
This switches the merged-PR fetch to GraphQL search, which counts against the 5000-points-per-hour GraphQL bucket instead of the search bucket. At ~1 point per page, 4 widgets × 10 pages = 40 points/storm — plenty of headroom.
Bonus: `repository.stargazerCount` comes inline in the GraphQL response, so the card/recent/top-repos transforms no longer need separate `getStarsForRepos` roundtrips. Eliminates ~36 extra core-API calls on cold start.
Diffs
Test plan