Skip to content

Commit 6c361d4

Browse files
fix: adapt to GitHub's rename of abuse limit to secondary rate limit (#438)
1 parent 325e3ee commit 6c361d4

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export function throttling(octokit: Octokit, octokitOptions = {}) {
121121
options.request.retryCount = retryCount;
122122

123123
const { wantRetry, retryAfter } = await (async function () {
124-
if (/\babuse\b/i.test(error.message)) {
124+
if (/\bsecondary rate\b/i.test(error.message)) {
125125
// The user has hit the abuse rate limit. (REST and GraphQL)
126126
// https://docs.github.com/en/rest/overview/resources-in-the-rest-api#abuse-rate-limits
127127

test/events.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ describe("Events", function () {
6868
status: 403,
6969
headers: { "retry-after": "60" },
7070
data: {
71-
message: "You have been rate limited to prevent abuse",
71+
message: "You have exceeded a secondary rate limit",
7272
},
7373
},
7474
],
@@ -112,7 +112,7 @@ describe("Events", function () {
112112
status: 403,
113113
headers: { "retry-after": "2" },
114114
data: {
115-
message: "You have been rate limited to prevent abuse",
115+
message: "You have exceeded a secondary rate limit",
116116
},
117117
},
118118
],
@@ -156,7 +156,7 @@ describe("Events", function () {
156156
status: 403,
157157
headers: {},
158158
data: {
159-
message: "You have been rate limited to prevent abuse",
159+
message: "You have exceeded a secondary rate limit",
160160
},
161161
},
162162
],

test/retry.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe("Retry", function () {
2929
{
3030
status: 403,
3131
headers: { "retry-after": "1" },
32-
data: { message: "You have been rate limited to prevent abuse" },
32+
data: { message: "You have exceeded a secondary rate limit" },
3333
},
3434
{ status: 200, headers: {}, data: { message: "Success!" } },
3535
],
@@ -69,7 +69,7 @@ describe("Retry", function () {
6969
},
7070
});
7171

72-
const message = "You have been rate limited to prevent abuse";
72+
const message = "You have exceeded a secondary rate limit";
7373
try {
7474
await octokit.request("GET /route", {
7575
request: {
@@ -366,7 +366,7 @@ describe("Retry", function () {
366366
},
367367
data: {
368368
message:
369-
"You have triggered an abuse detection mechanism. Please wait a few minutes before you try again.",
369+
"You have exceeded a secondary rate limit. Please wait a few minutes before you try again.",
370370
documentation_url:
371371
"https://developer.github.com/v3/#abuse-rate-limits",
372372
},

0 commit comments

Comments
 (0)