fix: split stats query to fit GitHub GraphQL per-query resource limits (RESOURCE_LIMITS_EXCEEDED) - #4918
Closed
luojiyin1987 wants to merge 13 commits into
Closed
Conversation
chore: add readme cards workflow
Signed-off-by: luojiyin <luojiyin@hotmail.com>
GitHub's GraphQL API now enforces a per-query resource budget that the combined stats query exceeds, causing every stats card to fail with RESOURCE_LIMITS_EXCEEDED. Merge the two aliased contributionsCollection selections into one, and split the stats fetch into three requests within the budget: contribution/count stats, paginated repositories, and repositoriesContributedTo. Adapt test fixtures to the per-query responses.
|
@luojiyin1987 is attempting to deploy a commit to the github readme stats Team on Vercel. A member of the Team first needs to authorize it. |
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.
Problem
Since GitHub tightened its GraphQL per-query resource budget, the combined
GRAPHQL_STATS_QUERYexceeds it and every/apistats card fails with:The error
pathpoints at whichever field exhausts the budget, making it look field-specific; probing shows the limit is cumulative.Fix
commits:/reviews:aliases into a singlecontributions: contributionsCollectionselection.GRAPHQL_STATS_QUERY, norepositoriesfield),GRAPHQL_REPOS_QUERY,repositoriesContributedToon its own (GRAPHQL_CONTRIBUTED_TO_QUERY).Trade-offs
commits_yearis set,totalPullRequestReviewContributionsis now scoped to the samefrom:window as commits (both live in one collection).Tests
fetchStats.test.jsdispatches on query content.faker()inapi.test.jsswitched fromreplyOncetoreply(three GraphQL calls now).awaiton two floatingrejectsassertions infetchStats.test.js.npm run lintandprettier --checkclean; stats/api/bench test suites pass.Cherry-pick of upstream PR #4916.
🤖 Generated with Claude Code