Back off when server fails (HTTP 50x) #173
Merged
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.
When the GitHub API replies with a server error (usually HTTP 502), retry up to
maxServerErrors
times withserverErrorBackOff
intervals in between.Currently, the inputs above are constants: each request will tolerate at most 10 errors and will wait 10 seconds between each attempt (this is in addition to any rate limiting imposed by the GitHub API). If needed, it is easy enough to add both as optional arguments to
fetchStreamed
.This is important for long-running batch jobs. Without this change, the package will just crash any time it encounters a GitHub HTTP 50x error (which are rare, but not unheard of), losing any pagination progress.