Skip to content

Retry delay should delay all queued requests #629

@jyasskin

Description

@jyasskin

I have an application that's hitting the secondary rate limit even after adding this plugin. I'm passing the following to try to recover:

const octokit = new Octokit({
  ...
  throttle: {
    ...
    onSecondaryRateLimit: (retryAfter, options:any, octokit, retryCount) => {
      octokit.log.warn(
        `Secondary rate limit exceeded for request ${options.query}`,
      );

      if (retryCount < 1 && retryAfter <= 120) {
        // Retry once and for at most 2 minutes.
        console.info(`Retrying after ${retryAfter} seconds.`);
        return true;
      }
    }
  },
});

But even though I see Retrying after 60 seconds. in the output, other requests are getting sent before the 60s delay and predictably also hitting the secondary rate limit. https://github.com/SGrondin/bottleneck#retries seems to say this shouldn't happen, but I haven't traced the code enough to see why it might be happening anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: BlockedSome technical or requirement is blocking the issueType: BugSomething isn't working as documented

    Type

    No type

    Projects

    Status

    🛑 Blocked/Awaiting Response

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions