Skip to content

Commit

Permalink
fix: when disable ipv6 leads to err (#10857)
Browse files Browse the repository at this point in the history
Signed-off-by: wuhanqing <hanqingwu@126.com>
  • Loading branch information
hanqingwu committed Dec 26, 2023
1 parent 13c975b commit 7c3ae83
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions apisix/cli/ops.lua
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ local function start(env, ...)

local ok, err, err_no = signal.kill(pid, signone)
if ok then
print("APISIX is running...")
print("the old process is still running, the new one won't be started!")
return
-- no such process
elseif err_no ~= errno.ESRCH then
Expand Down Expand Up @@ -920,15 +920,33 @@ local function sleep(n)
execute("sleep " .. tonumber(n))
end

local function wait_stop_finish(env, n)

for i = 1, n do
-- check running
local pid_path = env.apisix_home .. "/logs/nginx.pid"
local pid = util.read_file(pid_path)
pid = tonumber(pid)
if not pid or pid == 0 then
print("old apisix process has stopped")
return
else
sleep(1)
end
end

end

local function restart(env)
-- test configuration
test(env)
stop(env)
sleep(1)
wait_stop_finish(env,3)
start(env)
end



local function reload(env)
-- reinit nginx.conf
init(env)
Expand Down

0 comments on commit 7c3ae83

Please sign in to comment.