Skip to content

Commit

Permalink
poll events
Browse files Browse the repository at this point in the history
  • Loading branch information
bungle committed Dec 10, 2020
1 parent 8aafb37 commit 50569aa
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions kong/db/declarative/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,7 @@ do
if ok then
ok, err = kong.worker_events.post("declarative", "flip_config", default_ws)
if not ok then
ngx.shared.kong:delete(DECLARATIVE_FLIPS_NAME)
return nil, "failed to flip declarative config cache pages: " .. (err or "unknown error")
end

Expand All @@ -818,11 +819,6 @@ do
return nil, err
end

ok, err = kong.core_cache:save_curr_page()
if not ok then
return nil, "failed to persist cache page number inside shdict: " .. err
end

local sleep_left = DECLARATIVE_FLIPS_TTL
local sleep_time = 0.0375

Expand All @@ -839,7 +835,18 @@ do

ngx.sleep(sleep_time)
sleep_left = sleep_left - sleep_time
end

ok, err = kong.cache:save_curr_page()
if not ok then
ngx.shared.kong:delete(DECLARATIVE_FLIPS_NAME)
return nil, "failed to persist cache page number inside shdict: " .. err
end

ok, err = kong.core_cache:save_curr_page()
if not ok then
ngx.shared.kong:delete(DECLARATIVE_FLIPS_NAME)
return nil, "failed to persist core cache page number inside shdict: " .. err
end

ngx.shared.kong:delete(DECLARATIVE_FLIPS_NAME)
Expand Down

0 comments on commit 50569aa

Please sign in to comment.