Skip to content

Commit

Permalink
Use "secondary" instead of "abuse" for rate limit.
Browse files Browse the repository at this point in the history
GitHub renamed `abuse limits` to `secondary rate limits` in 2021:
https://docs.github.com/en/rest/overview/resources-in-the-rest-api#secondary-rate-limits

`@octokit/plugin-throttling` followed suit in March 2022, and released
version `3.6.0` with this new name (and deprecated `onAbuseLimit`):
octokit/plugin-throttling.js#455

This commit updates the README file to use the new name.
  • Loading branch information
nimadini committed Aug 4, 2022
1 parent 15aff0a commit f02beee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit f02beee

Please sign in to comment.