chore: catch error while new healthcheck instance#3213
Conversation
| healthcheck = require("resty.healthcheck") | ||
| end | ||
| local checker = healthcheck.new({ | ||
| local checker, err = healthcheck.new({ |
There was a problem hiding this comment.
Is it possible to write a test for it?
There was a problem hiding this comment.
I remember that error happened when more workers tried to create checkers at the same moment. In the PROD, I have encountered such problems. I will consider how to add test cases, but I think it's a bit difficult :(
There was a problem hiding this comment.
I can't find a way to reproduce it by using Test::Nginx. In my test case, I've set master_on,workers(10) and added a server on different port, I create many threads to connect that server when got the initial request, and wanted the different workers would handled that connections, but only the same worker which got the initial request dealt with the connection requests.
@membphis @spacewander Do you have a way to get test requests on different workers?
There was a problem hiding this comment.
AFAIK, there is no such a way.
What this PR does / why we need it:
catch error while new
healthcheckinstance and return the checker with nil.the function pick_server will treat the nodes as normal with the 'checker == nil', and get a correct one by rules.
fix #3169
Pre-submission checklist: