- 
                Notifications
    
You must be signed in to change notification settings  - Fork 60
 
Closed
Labels
Type: FeatureNew feature or requestNew feature or request
Description
This is a follow up to octokit/plugin-paginate-rest.js#33
Here is a simplified test case that I run in GitHub Actions.
(async () => {
  for (let index = 0; index < 10000; index++) {
    try {
      const { Octokit } = require("@octokit/core");
      const { createAppAuth } = require("@octokit/auth-app");
      const octokit = new Octokit({
        authStrategy: createAppAuth,
        auth: {
          id: process.env.TEST_APP_ID,
          privateKey: process.env.TEST_APP_PRIVATE_KEY,
          installationId: process.env.TEST_APP_INSTALLATION_ID,
        },
      });
      await octokit.request("GET /installation/repositories", {
        mediaType: {
          previews: ["machine-man"],
        },
      });
      process.stdout.write(".");
    } catch (error) {
      console.log("Error: ", error);
      process.exit(1);
    }
  }
  console.log("");
})();Here is a run that triggered the expected error:
https://github.com/octokit/sandbox/runs/705154995?check_suite_focus=true#step:5:1
The way this could work
- Keep track on weather any request was successful
 - If the first request using the installation authentication token fails with 401, log a warning and retry after 1s, then 2s, then 4s. The warning should include an explanation why the delay might be necessary in some cases
 - If a previous request using the same access token was successful, do not retry in case of a 401
 
I have asked the documentation team to document that behavior so we can reference it from our docs and error messages
steve-norman-rft
Metadata
Metadata
Assignees
Labels
Type: FeatureNew feature or requestNew feature or request