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
/cc @steve-norman-rft @droidpl
This is a follow up to octokit/plugin-paginate-rest.js#33
Here is a simplified test case that I run in GitHub Actions.
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
I have asked the documentation team to document that behavior so we can reference it from our docs and error messages
/cc @steve-norman-rft @droidpl