Skip to content

Commit

Permalink
fix pagination bug
Browse files Browse the repository at this point in the history
  • Loading branch information
dndx committed Aug 6, 2024
1 parent 7cd2b58 commit 856ca04
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions kong/clustering/services/sync/hooks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ local function get_all_nodes_with_sync_cap()
local ret = {}
local ret_n = 0

local res, err = kong.db.clustering_data_planes:page(1000)
local res, err = kong.db.clustering_data_planes:page(512)
if err then
return nil, "unable to query DB " .. err
end

if not res then
return nil, "node is not connected, node_id: " .. node_id
if not res then
return {}
end

for _, row in ipairs(res) do
Expand Down
4 changes: 2 additions & 2 deletions kong/db/strategies/connector.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ local fmt = string.format
local Connector = {
defaults = {
pagination = {
page_size = 1000,
max_page_size = 50000,
page_size = 512,
max_page_size = 512,
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion kong/db/strategies/off/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ local function page_for_prefix(self, prefix, size, offset, options, follow)
end

if err_or_more then
return ret, nil, last_key
return ret, nil, last_key .. "1"
end

return ret
Expand Down
5 changes: 4 additions & 1 deletion kong/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,6 @@ function Kong.init_worker()
err)
return
end
kong.core_cache = core_cache

kong.db:set_events_handler(worker_events)

Expand Down Expand Up @@ -913,6 +912,8 @@ function Kong.init_worker()
end

elseif declarative_entities then
kong.core_cache = core_cache

ok, err = load_declarative_config(kong.configuration,
declarative_entities,
declarative_meta,
Expand All @@ -938,6 +939,8 @@ function Kong.init_worker()
end
end

kong.core_cache = core_cache

local is_not_control_plane = not is_control_plane(kong.configuration)
if is_not_control_plane then
ok, err = execute_cache_warmup(kong.configuration)
Expand Down
1 change: 0 additions & 1 deletion kong/runloop/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ end


local function dao_crud_handler(data)
ngx.log(ngx.ERR, "dao_crud_handler")
local schema = data.schema
if not schema then
log(ERR, "[events] missing schema in crud subscriber")
Expand Down

0 comments on commit 856ca04

Please sign in to comment.