Skip to content

Commit

Permalink
style(db/declarative): small clean for load_into_cache() (#11507)
Browse files Browse the repository at this point in the history
  • Loading branch information
chronolaw authored Sep 5, 2023
1 parent 3a66099 commit 1ccd94f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions kong/db/declarative/import.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ local type = type
local pairs = pairs
local next = next
local insert = table.insert
local min = math.min
local null = ngx.null
local md5 = ngx.md5
local get_phase = ngx.get_phase
local yield = utils.yield
local sha256 = utils.sha256_hex
Expand Down Expand Up @@ -443,15 +441,16 @@ local load_into_cache_with_events
do
local events = require("kong.runloop.events")

local md5 = ngx.md5
local min = math.min

local exiting = ngx.worker.exiting

local function load_into_cache_with_events_no_lock(entities, meta, hash, hashes)
if exiting() then
return nil, "exiting"
end

local reconfigure_data

local ok, err, default_ws = load_into_cache(entities, meta, hash)
if not ok then
if err:find("MDB_MAP_FULL", nil, true) then
Expand All @@ -464,6 +463,7 @@ do
local router_hash
local plugins_hash
local balancer_hash

if hashes then
if hashes.routes ~= DECLARATIVE_EMPTY_CONFIG_HASH then
router_hash = md5(hashes.services .. hashes.routes)
Expand All @@ -479,13 +479,12 @@ do
targets_hash ~= DECLARATIVE_EMPTY_CONFIG_HASH
then
balancer_hash = md5(upstreams_hash .. targets_hash)

else
balancer_hash = DECLARATIVE_EMPTY_CONFIG_HASH
end
end

reconfigure_data = {
local reconfigure_data = {
default_ws,
router_hash,
plugins_hash,
Expand Down

1 comment on commit 1ccd94f

@khcp-gha-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bazel Build

Docker image available kong/kong:1ccd94fb84a9975587c387129f41b6567b614f80
Artifacts available https://github.com/Kong/kong/actions/runs/6086507291

Please sign in to comment.