Revolyssup commented on code in PR #12200:
URL: https://github.com/apache/apisix/pull/12200#discussion_r2097268121
##########
apisix/init.lua:
##########
@@ -868,6 +869,56 @@ local function healthcheck_passive(api_ctx)
end
+function _M.status()
+ core.response.exit(200, core.json.encode({
+ status = "ok" }),
+ { ["Content-Type"] = "application/json"
+ })
+end
+
+function _M.status_ready()
+ local local_conf = core.config.local_conf()
+ local provider = core.table.try_read_attr(local_conf, "deployment",
+ "role_traditional",
"config_provider") or
+ core.table.try_read_attr(local_conf, "deployment",
+ "role_data_plane",
"config_provider")
+ if provider == "yaml" or provider == "etcd" then
+ local status_shdict = ngx.shared["status-report"]
+ local pids = status_shdict:get_keys()
+ local errors = {}
+
+ for _, pid in ipairs(pids) do
+ local ready = status_shdict:get(pid)
+ if not ready then
+ core.log.warn("worker pid: ", pid, " has not received
configuration")
+ core.table.insert(errors, "worker pid: " .. pid ..
+ " has not received configuration")
+ break
+ end
+ end
Review Comment:
I think ngx.worker.count is not needed. All workers initialise and set the
id-> to false in init_worker() so we will iterate over all started workers.
--
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]