Skip to content

Commit

Permalink
fix with comments
Browse files Browse the repository at this point in the history
Signed-off-by: tzssangglass <[email protected]>
  • Loading branch information
tzssangglass committed Nov 12, 2024
1 parent 97b4fa5 commit 3050266
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions kong/status/ready.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ local PLUGINS_REBUILD_COUNTER_KEY = constants.PLUGINS_REBUILD_COUNTER_KEY
local ROUTERS_REBUILD_COUNTER_KEY = constants.ROUTERS_REBUILD_COUNTER_KEY
local DECLARATIVE_EMPTY_CONFIG_HASH = constants.DECLARATIVE_EMPTY_CONFIG_HASH

local KONG_STATUS_UNREADY = "kong:status:unready"
local KONG_STATUS_READY = "kong:status:ready"

local function is_dbless_ready(router_rebuilds, plugins_iterator_rebuilds)
if router_rebuilds < worker_count then
Expand Down Expand Up @@ -103,13 +103,12 @@ end
return {
["/status/ready"] = {
GET = function(self, dao, helpers)
local unready = kong_shm:get(KONG_STATUS_UNREADY)
if unready == nil then
kong_shm:set(KONG_STATUS_UNREADY, false)
local ready = kong_shm:get(KONG_STATUS_READY)
if ready == nil then
kong_shm:set(KONG_STATUS_READY, true)
end

if unready == true then
ngx_log(ngx_DEBUG, "not ready for proxying: unready")
if ready == false then
return kong.response.exit(503, { message = "unready" })
end

Expand All @@ -127,7 +126,7 @@ return {

["/status/unready"] = {
POST = function(self, dao, helpers)
kong_shm:set(KONG_STATUS_UNREADY, true)
kong_shm:set(KONG_STATUS_READY, false)
return kong.response.exit(204)
end
}
Expand Down

0 comments on commit 3050266

Please sign in to comment.