This is an automated email from the ASF dual-hosted git repository.
monkeydluffy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new 3b16fce06 fix(consul): worker will not exit while reload or quit
(#10342)
3b16fce06 is described below
commit 3b16fce060fbac39ee054784213a6bc81df526fc
Author: theweakgod <[email protected]>
AuthorDate: Fri Oct 20 15:49:29 2023 +0800
fix(consul): worker will not exit while reload or quit (#10342)
---
apisix/discovery/consul/init.lua | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/apisix/discovery/consul/init.lua b/apisix/discovery/consul/init.lua
index 253d0cb8c..32e306709 100644
--- a/apisix/discovery/consul/init.lua
+++ b/apisix/discovery/consul/init.lua
@@ -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
@@ -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)