Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Back off when server fails (HTTP 50x) #173

Merged
merged 3 commits into from
Oct 15, 2019

Conversation

filiph
Copy link
Contributor

@filiph filiph commented Oct 8, 2019

When the GitHub API replies with a server error (usually HTTP 502), retry up to maxServerErrors times with serverErrorBackOff 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.

filiph added 2 commits October 8, 2019 13:31
When the GitHub API replies with a server error (usually HTTP 502), retry up to `maxServerErrors` times with `serverErrorBackOff` 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 encounteres a GitHub HTTP 50x error (which are rare, but not unheard of), losing any pagination progress.
Copy link
Member

@robrbecker robrbecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Filip! This looks good and is a great addition. Looks like it just needs a master merge. I'd like to get this in the next release (5.4.0). I can handle updating the changelog, etc.

@robrbecker robrbecker merged commit 303aa68 into SpinlockLabs:master Oct 15, 2019
@filiph
Copy link
Contributor Author

filiph commented Oct 16, 2019

Sorry, I'm only seeing this now. Thanks for merging!

@filiph filiph deleted the server-backoff branch October 16, 2019 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants