Skip to content
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: use "secondary" instead of "abuse" for rate limit #2266

Merged
merged 1 commit into from Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -275,7 +275,7 @@ The time zone header will determine the timezone used for generating the timesta

`Octokit` implements request throttling using [`@octokit/plugin-throttling`](https://github.com/octokit/plugin-throttling.js/#readme)

By default, requests are retried once and warnings are logged in case hitting a rate or abuse limit
By default, requests are retried once and warnings are logged in case of hitting a rate or secondary rate limit

```js
{
Expand All @@ -290,9 +290,9 @@ By default, requests are retried once and warnings are logged in case hitting a
return true;
}
},
onAbuseLimit: (retryAfter, options, octokit) => {
onSecondaryRateLimit: (retryAfter, options, octokit) => {
octokit.log.warn(
`Abuse detected for request ${options.method} ${options.url}`
`SecondaryRateLimit detected for request ${options.method} ${options.url}`
);

if (options.request.retryCount === 0) {
Expand Down
6 changes: 3 additions & 3 deletions src/octokit.ts
Expand Up @@ -15,7 +15,7 @@ export const Octokit = OctokitCore.plugin(
userAgent: `octokit.js/${VERSION}`,
throttle: {
onRateLimit,
onAbuseLimit,
onSecondaryRateLimit,
},
});

Expand All @@ -33,9 +33,9 @@ function onRateLimit(retryAfter: number, options: any, octokit: any) {
}

// istanbul ignore next no need to test internals of the throttle plugin
function onAbuseLimit(retryAfter: number, options: any, octokit: any) {
function onSecondaryRateLimit(retryAfter: number, options: any, octokit: any) {
octokit.log.warn(
`Abuse detected for request ${options.method} ${options.url}`
`SecondaryRateLimit detected for request ${options.method} ${options.url}`
);

if (options.request.retryCount === 0) {
Expand Down