From f02beee63e04e5432a4944d2764dd3c92746f936 Mon Sep 17 00:00:00 2001 From: Nima Dini Date: Thu, 4 Aug 2022 17:42:24 +0000 Subject: [PATCH] Use "secondary" instead of "abuse" for rate limit. 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. --- README.md | 6 +++--- src/octokit.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 39d00374c5..65a87c789f 100644 --- a/README.md +++ b/README.md @@ -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 { @@ -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) { diff --git a/src/octokit.ts b/src/octokit.ts index 6654382c6f..39a3acb235 100644 --- a/src/octokit.ts +++ b/src/octokit.ts @@ -15,7 +15,7 @@ export const Octokit = OctokitCore.plugin( userAgent: `octokit.js/${VERSION}`, throttle: { onRateLimit, - onAbuseLimit, + onSecondaryRateLimit, }, }); @@ -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) {