Skip to content

GraphQL rate limit errors don't always get retried. #632

@jyasskin

Description

@jyasskin

I ran a GH Action that exceeds its primary rate limit, and the first time (https://github.com/jyasskin/spec-maintenance/actions/runs/6581598228/job/17881791340#check-step-7) plugin-throttling called my onRateLimit function and retried accordingly, and the second time (https://github.com/jyasskin/spec-maintenance/actions/runs/6581598228/job/17920483150) (on the same commit), it didn't.

It looks like the ones that skip onRateLimit have a 200 response code, while earlier runs that weren't using plugin-throttling showed a 403 response code for secondary rate limits. (They didn't get far enough to exceed the primary rate limit, so I don't have their response code for that.) Could Bottleneck only be firing the failed event on HTTP-level failures, and so

if (
res.data.errors != null &&
// @ts-expect-error
res.data.errors.some((error) => error.type === "RATE_LIMITED")
) {
const error = Object.assign(new Error("GraphQL Rate Limit Exceeded"), {
response: res,
data: res.data,
});
throw error;
should be calling onRateLimit itself?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions