Skip to content

Commit

Permalink
fix(consul): worker will not exit while reload or quit (#10342)
Browse files Browse the repository at this point in the history
  • Loading branch information
theweakgod authored Oct 20, 2023
1 parent 2c04497 commit 3b16fce
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apisix/discovery/consul/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ local ngx_timer_every = ngx.timer.every
local log = core.log
local json_delay_encode = core.json.delay_encode
local ngx_worker_id = ngx.worker.id
local exiting = ngx.worker.exiting
local thread_spawn = ngx.thread.spawn
local thread_wait = ngx.thread.wait
local thread_kill = ngx.thread.kill
Expand Down Expand Up @@ -276,7 +277,7 @@ end


local function check_keepalive(consul_server, retry_delay)
if consul_server.keepalive then
if consul_server.keepalive and not exiting() then
local ok, err = ngx_timer_at(0, _M.connect, consul_server, retry_delay)
if not ok then
log.error("create ngx_timer_at got error: ", err)
Expand Down

0 comments on commit 3b16fce

Please sign in to comment.