hanqingwu commented on code in PR #10696:
URL: https://github.com/apache/apisix/pull/10696#discussion_r1439994688


##########
apisix/cli/ops.lua:
##########
@@ -916,10 +916,32 @@ local function stop(env)
 end
 
 
+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 then
+            print("old apisix process has stopped")
+            return
+        else
+            sleep(1)
+        end
+    end
+end
+
+
 local function restart(env)
   -- test configuration
   test(env)
   stop(env)
+  wait_stop_finish(env, 3)

Review Comment:
   ok



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to