-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix various rate limiting issues #1424
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1424 +/- ##
==========================================
- Coverage 81.15% 81.12% -0.04%
==========================================
Files 58 58
Lines 4261 4248 -13
Branches 936 935 -1
==========================================
- Hits 3458 3446 -12
Misses 563 563
+ Partials 240 239 -1
Continue to review full report at Codecov.
|
better time remaining messaging
…e last tag. getting all commits can trigger rate limits and canaries should be lightweight
latestTag = await this.git.getFirstCommit(); | ||
} | ||
|
||
const commitsInRelease = await this.release.getCommits(latestTag); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this because getting all the commits in a canary release with no recent release can lead to hitting the rate limits. With canaries this is especially easy to hit because they are made so often.
); | ||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will now actually retry after abuse limit is hit
@@ -488,6 +491,7 @@ export default class Git { | |||
} | |||
|
|||
/** Search to GitHub project's issue and pull requests */ | |||
@memoize() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a single run if the search query is the same it should be safe to memoize. The search
endpoints have super low rate limits so this should help a bit.
@@ -505,10 +509,11 @@ export default class Git { | |||
} | |||
|
|||
/** Run a graphql query on the GitHub project */ | |||
@memoize() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing goes for graphql queries. Easy to memoize.
async graphql<T>(query: string) { | ||
this.logger.verbose.info("Querying Github using GraphQL:\n", query); | ||
|
||
const data = await graphql<T>(query, { | ||
const data = await this.github.graphql<T>(query, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching to octokit
's graphql function will make sure that it is rate/abuse limited properly
@@ -283,6 +283,7 @@ export default class Release { | |||
* @param from - Tag or SHA to start at | |||
* @param to - Tag or SHA to end at (defaults to HEAD) | |||
*/ | |||
@memoize() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was iffy on adding memoization here. But since auto
will never care about generated commits I think it's safe to memoize this function. This should also help with some log reduction
return author; | ||
// prettier-ignore | ||
// eslint-disable-next-line no-await-in-loop | ||
const prs = await auto.git?.graphql<Record<string, any>>(` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call graphql API serially so we can use the memoized the graphql call
@@ -611,12 +612,9 @@ export default class Release { | |||
hash: commit.hash, | |||
}); | |||
} else if (commit.authorEmail) { | |||
const author = await this.git.getUserByEmail(commit.authorEmail); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getUserByEmail
used search which is easily rate-limited, just omitting instead. It's 50/50 that the user has their email public anyway
@@ -14,9 +14,6 @@ export default class FirstTimeContributorPlugin implements IPlugin { | |||
|
|||
/** Tap into auto plugin points. */ | |||
apply(auto: Auto) { | |||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | |||
const cache: Record<string, Record<string, any>> = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rely on git
client memoization instead of custom cache
🚀 PR was released in |
What Changed
previously we would just error out on the abuse limit, now we will retry
Why
#1422 (I'm not sure this PR solves for #1422)
📦 Published PR as canary version:
under canary scope @auto-canary@9.49.3-canary.1424.17806.0
✨ Test out this PR locally via:
npm install @auto-canary/bot-list@9.49.3-canary.1424.17806.0 npm install @auto-canary/auto@9.49.3-canary.1424.17806.0 npm install @auto-canary/core@9.49.3-canary.1424.17806.0 npm install @auto-canary/all-contributors@9.49.3-canary.1424.17806.0 npm install @auto-canary/brew@9.49.3-canary.1424.17806.0 npm install @auto-canary/chrome@9.49.3-canary.1424.17806.0 npm install @auto-canary/cocoapods@9.49.3-canary.1424.17806.0 npm install @auto-canary/conventional-commits@9.49.3-canary.1424.17806.0 npm install @auto-canary/crates@9.49.3-canary.1424.17806.0 npm install @auto-canary/exec@9.49.3-canary.1424.17806.0 npm install @auto-canary/first-time-contributor@9.49.3-canary.1424.17806.0 npm install @auto-canary/gem@9.49.3-canary.1424.17806.0 npm install @auto-canary/gh-pages@9.49.3-canary.1424.17806.0 npm install @auto-canary/git-tag@9.49.3-canary.1424.17806.0 npm install @auto-canary/gradle@9.49.3-canary.1424.17806.0 npm install @auto-canary/jira@9.49.3-canary.1424.17806.0 npm install @auto-canary/maven@9.49.3-canary.1424.17806.0 npm install @auto-canary/npm@9.49.3-canary.1424.17806.0 npm install @auto-canary/omit-commits@9.49.3-canary.1424.17806.0 npm install @auto-canary/omit-release-notes@9.49.3-canary.1424.17806.0 npm install @auto-canary/released@9.49.3-canary.1424.17806.0 npm install @auto-canary/s3@9.49.3-canary.1424.17806.0 npm install @auto-canary/slack@9.49.3-canary.1424.17806.0 npm install @auto-canary/twitter@9.49.3-canary.1424.17806.0 npm install @auto-canary/upload-assets@9.49.3-canary.1424.17806.0 # or yarn add @auto-canary/bot-list@9.49.3-canary.1424.17806.0 yarn add @auto-canary/auto@9.49.3-canary.1424.17806.0 yarn add @auto-canary/core@9.49.3-canary.1424.17806.0 yarn add @auto-canary/all-contributors@9.49.3-canary.1424.17806.0 yarn add @auto-canary/brew@9.49.3-canary.1424.17806.0 yarn add @auto-canary/chrome@9.49.3-canary.1424.17806.0 yarn add @auto-canary/cocoapods@9.49.3-canary.1424.17806.0 yarn add @auto-canary/conventional-commits@9.49.3-canary.1424.17806.0 yarn add @auto-canary/crates@9.49.3-canary.1424.17806.0 yarn add @auto-canary/exec@9.49.3-canary.1424.17806.0 yarn add @auto-canary/first-time-contributor@9.49.3-canary.1424.17806.0 yarn add @auto-canary/gem@9.49.3-canary.1424.17806.0 yarn add @auto-canary/gh-pages@9.49.3-canary.1424.17806.0 yarn add @auto-canary/git-tag@9.49.3-canary.1424.17806.0 yarn add @auto-canary/gradle@9.49.3-canary.1424.17806.0 yarn add @auto-canary/jira@9.49.3-canary.1424.17806.0 yarn add @auto-canary/maven@9.49.3-canary.1424.17806.0 yarn add @auto-canary/npm@9.49.3-canary.1424.17806.0 yarn add @auto-canary/omit-commits@9.49.3-canary.1424.17806.0 yarn add @auto-canary/omit-release-notes@9.49.3-canary.1424.17806.0 yarn add @auto-canary/released@9.49.3-canary.1424.17806.0 yarn add @auto-canary/s3@9.49.3-canary.1424.17806.0 yarn add @auto-canary/slack@9.49.3-canary.1424.17806.0 yarn add @auto-canary/twitter@9.49.3-canary.1424.17806.0 yarn add @auto-canary/upload-assets@9.49.3-canary.1424.17806.0