Skip to content

Commit f4b4bbd

Browse files
committed
GraphQL queries can exceed the rate limit even with x-ratelimit-remaining === 0.
1 parent d28cd03 commit f4b4bbd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ export function throttling(octokit: Octokit, octokitOptions: OctokitOptions) {
137137
return { wantRetry, retryAfter };
138138
}
139139
if (
140-
error.response.headers != null &&
141-
error.response.headers["x-ratelimit-remaining"] === "0"
140+
(error.response.headers != null &&
141+
error.response.headers["x-ratelimit-remaining"] === "0"
142+
) || (error.response.data?.errors ?? []).some((error) => error.type === "RATE_LIMITED")
142143
) {
143144
// The user has used all their allowed calls for the current time period (REST and GraphQL)
144145
// https://docs.github.com/en/rest/reference/rate-limit (REST)

0 commit comments

Comments
 (0)