-
-
Notifications
You must be signed in to change notification settings - Fork 916
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
Retry on some non-2xx HTTP status codes #417
Comments
I think we should do this. I propose is that we retry on the following methods and status codes by default: Methods: We also need to respect the Related issue: #379 @lukechilds @reconbot @floatdrop @brandon93s Thoughts? |
Retry after support is awesome |
One potential side effect to be aware of, especially if we're thinking of enabling this by default: Consider you reach the request limit quota for the API you're using and they return This would mean, if we by default retry That doesn't seem very intuitive and could cause bugs that would be a nightmare to track down. This seems like a great feature but might be better as opt in or not whitelisting |
I think automatically retrying is probably not a great idea in general,
this would be a good time to change that behavior.
…On Sun, Feb 11, 2018, 10:42 AM Luke Childs ***@***.***> wrote:
One potential side effect to be aware of, especially if we're thinking of
enabling this by default:
Consider you reach the request limit quota for the API you're using and
they return 429 Too Many Requests with a Retry-After header set for when
your quota resets next month.
This would mean, if we by default retry 429s and respect Retry-After,
that making a request with Got to your API once you've hit your quota would
return a Promise that may not resolve for up to 30 days in the future.
That doesn't seem very intuitive and could cause bugs that would be a
nightmare to track down.
This seems like a great feature but might be better as opt in or not
whitelisting 429.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#417 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABlbl7-8eIcQ1WuaJLl-2zgTRhB62q1ks5tTwplgaJpZM4QgQwm>
.
|
Networks are inherently unreliable. I think retrying by default makes sense, but we should be very conservative with the default. |
This list is sensible, as these methods should be safe or idempotent. Would this functionality be rolled up into the existing
|
I was thinking of combining them, but also allow passing an object where people can customize: retries: {
retry: Number | Function,
methods: string[],
statusCodes: number[]
} Thoughts?
Why do you think so?
I agree. Let's take it out. |
Actually, regarding
So it seems we could handle |
Agreed, retry
Looks good to me. This can also be made backwards compatible by mapping
The aforementioned errors should be safe, but I've encountered some fairly non-standard APIs where I wouldn't want to retry on a |
@sindresorhus I'd like to use auto-retries on a 202 response (since it's async). However, it seems that |
Hi everyone, I came across this on a hunch that requests were automatically retried. @lukechilds said in his comment that:
I have to say I entirely agree. It depends on how you're using this library, but I'd much rather tell my users that the request was rate limited than allow it to infinitely keep retrying. I've disabled it in my config, but thought I'd add my two cents here. Thanks for creating this library, it's great! |
He was referring to retrying on 429 status code |
Sorry if I wasn’t clear, so was I |
Hi,
Just wanted to check why got doesn't do this...!
I thought the
retries
option would also be called HTTP errors but this doesn't appear to be the case (Promise / as stream) - is this by design?I'd like got to retry certain 5xx error codes.
Cheers,
Rich
The text was updated successfully, but these errors were encountered: