Fix retrying uploads by using Octokit retry plugin. #226
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This removes a whole bunch of error handling logic from the upload library that it turns out never actually gets called. It all works under the assumption that Octokit will return a response even if a request fails with a bad status code but this is actually not true. Instead Octokit rejects the promise so the upload immediately fails anyway.
I've replaced all this with the Octokit Retry plugin. This has the advantage that we're retrying on all the status codes that GitHub officially wants us to (including some 4xx codes), and that we're retrying for all types of requests to the GitHub API, not just SARIF uploads.
By default it retries 3 times with an exponential backoff (I think of 1, 4 and 8 seconds) but we can tweak that if we decide we want more retries or a longer backoff.
Merge / deployment checklist