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
no_timer option can work in non debug mode #68
Conversation
PTAL @thibaultcha |
/rebuild |
maybe you can add some test case, so we can know the effect? |
lib/resty/upstream/healthcheck.lua
Outdated
@@ -54,7 +54,6 @@ local function errlog(...) | |||
end | |||
|
|||
local function debug(...) | |||
-- print("debug mode: ", debug_mode) |
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.
better not introduce unrelated changes.
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.
I have reverted these unrelated changes.
@wangrzneu will you take care of the Travis failure thing? |
Yes, I add a new case and I will try to make it pass. |
Done. I add |
I have fixed it. But something wrong happens in travis CI. |
I fix CI by updating OPENSSL_VER. |
@wangrzneu |
I think the no_timer should only run in the debug mode, otherwise the health check will run one time only, and it can not check the issue of upsteams, right? |
This change will help me change the health check options without reloading the openresty process. And the health check can be triggered using a timer outside the openresty process. |
The health check can be triggered using a timer outside the openresty process. |
@wangrzneu can you give a sample that how you use it? I don't think I got you. |
My nginx.conf is like:
I use another program (implemented by golang) to request the /healthcheck periodically, and the arguments can be changed without restart openresty worker process. The healthcheck request is like |
@@ -1451,3 +1451,82 @@ healthcheck: peer 127\.0\.0\.1:12355 was checked to be not ok | |||
healthcheck: peer 127\.0\.0\.1:12356 was checked to be not ok | |||
healthcheck: peer 127\.0\.0\.1:12359 was checked to be not ok | |||
$/ | |||
|
|||
=== TEST 16: effect of no_timer (healthcheck options can be changed) |
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.
style: we need three blank lines before this line. you are recommended to use the reindex
tool to do it automatically:
https://github.com/openresty/openresty-devel-utils/blob/master/reindex
doc is still in the PR: https://github.com/openresty/openresty-devel-utils/pull/29/files#diff-04c6e90faac2675aa89e2176d2eec7d8R237
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.
done
@wangrzneu I think I got you now. my opinion, it should be ok to merge it into master though it's not the recommended way to use this library. |
|
@doujiang24 I agree with you, the change is small and no impact on existing functions and parameters. And I think if we not recommend use this lib like this way, maybe the test cases should be more simple and check |
@wangrzneu I think maybe you should test the case when has multiple upstream, because upstream_checker_statuses is init in content_by_lua_block, so maybe some worker do not have the specific key in In first request, check with foo.com, hit 0 worker:
In second request, check with boo.com, hit 1 worker:
In addition, welcome to the official form https://forum.openresty.us/ to share and discuss |
remove debug_mode limit of no_timer option