Skip to content

Commit

Permalink
fix: use "secondary" instead of "abuse" for rate limit (#2266)
Browse files Browse the repository at this point in the history
  • Loading branch information
nimadini committed Aug 9, 2022
1 parent 4346dec commit 650d10a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
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

1 comment on commit 650d10a

@mzman375

This comment was marked as off-topic.

Please sign in to comment.