Warn about expensive queries in GithubAuthV4Service
- Dominant language
- JavaScript
- Stars
- 27.2k
- Forks
- 5.6k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 46
Description
:clipboard: **Description**
We should use this method
https://developer.github.com/v4/guides/resource-limitations/#calculating-nodes-in-a-call
to work out the query cost before we make the call and error if it is going to be over some threshold instead of issueing the query. Because we're using `gql` template literals, we've got the parsed query available but there's some work to accurately implement the calculation.
Just thinking one step ahead, if there isn't already a third party package we can lean on here, this might be a good project to develop as a package. As GH V4 API usage increases, I can see this being a common requirement for other applications using the API.
See notes: https://github.com/badges/shields/pull/3763#discussion_r306513358
Contributor guide
Research direction
Start at GithubAuthV4Service and read GitHub's GraphQL resource-limitations guidance, along with the notes in pull request 3763. Determine how the parsed gql template can support node-cost calculation and what threshold should trigger an error. Done means expensive queries are identified before execution and rejected consistently, with behavior verified against representative queries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, graphql, javascript
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100