Skip to content

Commit

Permalink
Bump @octokit/plugin-throttling from 3.5.1 to 3.5.2 (#49)
Browse files Browse the repository at this point in the history
* Bump @octokit/plugin-throttling from 3.5.1 to 3.5.2

Bumps [@octokit/plugin-throttling](https://github.com/octokit/plugin-throttling.js) from 3.5.1 to 3.5.2.
- [Release notes](https://github.com/octokit/plugin-throttling.js/releases)
- [Commits](octokit/plugin-throttling.js@v3.5.1...v3.5.2)

---
updated-dependencies:
- dependency-name: "@octokit/plugin-throttling"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Updates for GitHub secondary rate limit renaming

Reference: octokit/plugin-throttling.js#438

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Brian Flad <bflad417@gmail.com>
  • Loading branch information
dependabot[bot] and bflad committed Dec 10, 2021
1 parent 6b5c00b commit b71c9f1
Show file tree
Hide file tree
Showing 6 changed files with 4,961 additions and 19 deletions.
6 changes: 3 additions & 3 deletions action.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ describe('action', () => {
});
});

test('retries abuse limit errors', (done) => {
test('retries secondary rate limit errors', (done) => {
const scope = nock('https://api.github.com')
.get('/repos/hashicorp/hc-releases/releases/tags/v0.11.4')
.reply(403, {
message: "You have triggered an abuse detection mechanism and have been temporarily blocked from content creation. Please retry your request again later.",
documentation_url: "https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits"
message: "You have exceeded a secondary rate limit and have been temporarily blocked from content creation. Please retry your request again later.",
documentation_url: "https://docs.github.com/rest/overview/resources-in-the-rest-api#secondary-rate-limits"
})
.get('/repos/hashicorp/hc-releases/releases/tags/v0.11.4')
.reply(200, mockRelease)
Expand Down
12 changes: 6 additions & 6 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions octokit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const { GitHub, getOctokitOptions } = require('@actions/github/lib/utils')
const { retry } = require('@octokit/plugin-retry')
const { throttling } = require('@octokit/plugin-throttling')

const abuseLimitRetries = 5
const rateLimitRetries = 5
const secondaryRateLimitRetries = 5

module.exports = function client(token) {
const Octokit = GitHub.plugin(throttling, retry);
Expand All @@ -19,14 +19,14 @@ module.exports = function client(token) {

options.throttle = {
onAbuseLimit(retryAfter, options) {
core.info(`Abuse limit triggered for request ${options.method} ${options.url} (attempt ${options.request.retryCount}/${abuseLimitRetries})`)
core.info(`Secondary rate limit triggered for request ${options.method} ${options.url} (attempt ${options.request.retryCount}/${secondaryRateLimitRetries})`)

if (options.request.retryCount < abuseLimitRetries) {
if (options.request.retryCount < secondaryRateLimitRetries) {
core.info(`Retrying after ${retryAfter} seconds`)
return true
}

core.warning(`Exhausted abuse limit retry count (${abuseLimitRetries}) for ${options.method} ${options.url}`)
core.warning(`Exhausted secondary rate limit retry count (${secondaryRateLimitRetries}) for ${options.method} ${options.url}`)
},
onRateLimit(retryAfter, options) {
core.info(`Rate limit triggered for request ${options.method} ${options.url} (attempt ${options.request.retryCount}/${rateLimitRetries})`)
Expand Down
Loading

0 comments on commit b71c9f1

Please sign in to comment.