-
Notifications
You must be signed in to change notification settings - Fork 53
retry http 5xx status as well #139
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
Conversation
a78400d
to
39d992d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good, I like this
i'll backport the rename to 1.9 with deprecation, and remove the BC code here |
b6e5b59
to
8bfb2f8
Compare
rebased and cleaned up. this is now ready for review again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good, just some minor changes
8bfb2f8
to
29ff637
Compare
8164de2
to
4dfc148
Compare
9c86096
to
0d8afd7
Compare
0d8afd7
to
5be99a5
Compare
Are you sure this is a good idea? 5xx generally means everything is broken and the server tells the client to leave them alone. Imagine if everyone retried requests upon an 500 error: poor server wouldn't have any chance to recover. |
What other request should you retry? 4xx means that the request itself is wrong. |
Not necessarily. 404 could mean a resource is not ready yet, but will be at some point. I guess retry from application and retry from http client point of view mean two different things. |
People can always configure reties themselves for that case though. For example, I do this when hitting the GitHub API, because they have a lag due to SQL replication. |
to me retrying 5xx seems reasonable, might be a temporary lapse in server communication or a database deadlock or whatnot. we can also by default not retry any response codes, if we think that is better. just having the configuration option has value already. what do we do? |
5be99a5
to
4a1a919
Compare
If you are using the RetryPlugin you are assuming that at least some request should be retried. I understand both arguments. I guess it depends on what kind of services you are using. I dont mind retrying my 500 requests when Im requesting github. But I may reconsider if I querying my own "easy to dos"-servers. I vote for a merge. |
we can add a warning in the documentation. there is the exponential backoff, so there is not that much requests to be expected. |
4a1a919
to
dd8cfcd
Compare
91978ed
to
71c7aa9
Compare
added documentation PR and realized i only want to retry codes from 500 to < 600. some systems (ab)use higher http status codes for custom things and we don't want to accidentally interact with those by default. |
71c7aa9
to
2810181
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @dbu
So I don't understand how this On another topic please rethink the usage of |
Elaborating this.. Using guzzle retry middleware... I only tend to retry 503 cases and also cases that the request was not even sent.. (status code 0 because of cURL)... Or cases that I got a response and I must look inside of the response... |
allowing to pass following our slack discussion, i added a note to the ErrorPlugin that indeed it is violating PSR-18. it can still be used when writing an application and wanting exceptions, but must not be used with third party libraries. |
I understand these part.. None the less the I saw also the documentation.. but I don't believe that the documentation here saves the day.. in overall, for what my opinion is worth it, I am not excited very much about these changes... :) |
What's in this PR?
Add retry for responses with a server error status code.
Checklist
TODO