Fix/Retries times setting's idempotent method checking
Summary
Optimized balancer's set_more_tries's conditions, added idempotent method condition
Full changelog
- Added idempotent checking for Calling set_more_tries .
@jacobslei Do you see non-idempotent methods currently being retried, or is this a suggestion for a performance improvement? As of today, non-idempotent methods should already not be retried, as per the default values of the proxy_next_upstream directive. I suspect the latter, but your PR's title mentions that it is a "fix".
@thibaultcha our cases: Under the situation that we had set proxy_next_upstream directive for upstream 500 error and set retries times more then 0 for balancer, when we sent a post method request and the upstream server return 500, the next time's retry, then the OpenResty server returned internal error page.
"As of today, non-idempotent methods should already not be retried", it's right.
I meant, if you use ngx.balancer.set_more_retries with input parameter greater than 0 for non-idempotent request , when the upstream server return error, the OpenResty's internal error will occur.
sorry, my English is not very well 😄
@jacobslei Oh, interesting! That would be a nice catch. Would you mind contributing a test for this behavior as well then? It will serve both as a regression test and as a way to demonstrate the issue :) And we require it in order to be able to merge your PR, accessorily... Such a test should probably live in https://github.com/Kong/kong/blob/master/spec/02-integration/05-proxy/09-balancer_spec.lua
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
jacobs seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.
Closing because of lack of activity. We would like to accept this contribution if anyone wishes to pick this back up.