Remove the rateLimit selection from the MaxPullRequest GraphQL query#8812
Merged
alexr00 merged 3 commits intoJul 2, 2026
Merged
Conversation
MaxPullRequest is a very high-frequency change-detection poll, and its handler (_getMaxItem) only reads the latest PR number — it never consumes the rateLimit block. The only generic consumer (RateLogger.logRateLimit) already degrades gracefully when rateLimit is absent (it falls back to the ?? 5000 / ?? 1000 defaults and other queries still report it), so removing this top-level field from the hottest query has no functional impact. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
|
This is used. |
rateLimit selection from the MaxPullRequest GraphQL query
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces GraphQL payload/field resolution work for one of the extension’s highest-volume operations (MaxPullRequest) by removing an unused top-level rateLimit { ...RateLimit } selection that the actual caller (_getMaxItem) never reads.
Changes:
- Remove the
rateLimit { ...RateLimit }selection from theMaxPullRequestGraphQL query to avoid requesting unused data on a hot polling path.
Show a summary per file
| File | Description |
|---|---|
| src/github/queriesShared.gql | Removes the unused rateLimit selection from the MaxPullRequest query to reduce per-request overhead. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Low
alexr00
approved these changes
Jul 2, 2026
dbaeumer
approved these changes
Jul 2, 2026
Member
|
/AzurePipelines run |
|
Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
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.
MaxPullRequestrepresents a big chunk of our graphql traffic volume and we're currently trying to optimize it.The
rateLimitportion is only used byLoggingApolloClient.querywhich is a high level client and it's never read by the query actual caller -_getMaxItem- shared by bothMaxIssueandMaxPullRequest- returns only number. It never readsdata.rateLimit.Since other queries are requesting this field the global store should be fine and updated on any other occasion.
🤖 AI-generated description
What changed
This PR removes the top-level
rateLimit { ...RateLimit }selection from theMaxPullRequestquery insrc/github/queriesShared.gql. No other queries are touched —MaxIssueand the ~28 other operations that selectrateLimitkeep it, and the sharedfragment RateLimit on RateLimitremains in use elsewhere, so it stays defined.Why
MaxPullRequestis a high-frequency, per-repo change-detection poll — one of the hottest GraphQL operations the extension emits. Its handler_getMaxItem(src/github/githubRepository.ts) reads onlydata.repository.issues.edges[0].node.number(the latest PR number) and never touchesdata.rateLimit. SelectingrateLimiton every poll asks the GitHub GraphQL API to resolve an extra top-level field whose result is discarded. Dropping it trims that unused resolver from the highest-volume query.Scope & safety
RateLogger.logRateLimit(src/github/loggingOctokit.ts), invoked by theLoggingApolloClient.querywrapper on every query. It readsresolvedResult?.data?.rateLimitand already degrades gracefully when the field is absent: it falls back to?? 5000/?? 1000defaults. As a result, removing the selection produces no spurious "Unexpectedly low rate limit" warning, and thepr.lowRateLimitRemainingtelemetry simply does not fire for this single call path.rateLimitcontinues to report it, so overall rate-limit monitoring and telemetry are unaffected._getMaxItemdoes not referencerateLimit, and theMaxIssueResponseinterface still applies toMaxIssue. The.gqlfiles are loaded at build time via the graphql-tag webpack loader; there is no committed generated TypeScript to regenerate.Notes
MaxPullRequestonly, leavingMaxIssueand all otherrateLimit-selecting queries as-is.logRateLimitalready handles the missing-field case, this is a safe no-op for behavior — it only reduces whatMaxPullRequestasks the API to resolve.