Skip to content
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

add worker exiting judge #47

Merged
merged 1 commit into from
Sep 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ Versioning is strictly based on [Semantic Versioning](https://semver.org/)
* fix: makefile; make install
* feature: added a status version field [#54](https://github.com/Kong/lua-resty-healthcheck/pull/54)
* feature: add headers for probe request [#54](https://github.com/Kong/lua-resty-healthcheck/pull/54)
* fix: exit early when reloading during a probe [#47](https://github.com/Kong/lua-resty-healthcheck/pull/47)

### 1.3.0 (17-Jun-2020)

Expand Down
5 changes: 5 additions & 0 deletions lib/resty/healthcheck.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ local resty_lock = require ("resty.lock")
local re_find = ngx.re.find
local bit = require("bit")
local ngx_now = ngx.now
local ngx_worker_exiting = ngx.worker.exiting
local ssl = require("ngx.ssl")

-- constants
Expand Down Expand Up @@ -903,6 +904,10 @@ end
-- executes a work package (a list of checks) sequentially
function checker:run_work_package(work_package)
for _, work_item in ipairs(work_package) do
if ngx_worker_exiting() then
self:log(DEBUG, "worker exting, skip check")
break
end
self:log(DEBUG, "Checking ", work_item.hostname or "", " ",
work_item.hostheader and "(host header: ".. work_item.hostheader .. ")"
or "", work_item.ip, ":", work_item.port,
Expand Down