Skip to content

Commit 0c5cd08

Browse files
committed
Simulate graphql queries with cost>1 in the rate limiting tests.
1 parent 46e933f commit 0c5cd08

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export function throttling(octokit: Octokit, octokitOptions: OctokitOptions) {
139139
if (
140140
(error.response.headers != null &&
141141
error.response.headers["x-ratelimit-remaining"] === "0"
142-
) || (error.response.data?.errors ?? []).some((error) => error.type === "RATE_LIMITED")
142+
) || (error.response.data?.errors ?? []).some((error:any) => error.type === "RATE_LIMITED")
143143
) {
144144
// The user has used all their allowed calls for the current time period (REST and GraphQL)
145145
// https://docs.github.com/en/rest/reference/rate-limit (REST)

test/retry.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ describe("Retry", function () {
250250
{
251251
status: 200,
252252
headers: {
253-
"x-ratelimit-remaining": "0",
253+
"x-ratelimit-remaining": "1",
254254
"x-ratelimit-reset": "123",
255255
},
256256
data: { errors: [{ type: "RATE_LIMITED" }] },
@@ -300,7 +300,7 @@ describe("Retry", function () {
300300
{
301301
status: 200,
302302
headers: {
303-
"x-ratelimit-remaining": "0",
303+
"x-ratelimit-remaining": "1",
304304
"x-ratelimit-reset": "123",
305305
},
306306
data: { errors: [{ type: "RATE_LIMITED" }] },

0 commit comments

Comments
 (0)