Skip to content

Commit

Permalink
exchange do_sync/sync_handler
Browse files Browse the repository at this point in the history
  • Loading branch information
chronolaw committed Oct 14, 2024
1 parent 2102fd9 commit 95e907f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions kong/clustering/services/sync/rpc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ function _M:init(manager, is_cp)
end


local function sync_handler()
local function do_sync()
local ns_deltas, err = kong.rpc:call("control_plane", "kong.sync.v2.get_delta",
{ default =
{ version =
Expand Down Expand Up @@ -307,19 +307,19 @@ local function sync_handler()
end


local function do_sync(premature)
local function sync_handler(premature)
if premature then
return
end

local res, err = concurrency.with_worker_mutex(SYNC_MUTEX_OPTS, function()
-- here must be 2 times
for _ = 1, 2 do
local ok, err = sync_handler()
local ok, err = do_sync()
if not ok then
return nil, err
end
end -- for _, delta
end -- for

return true
end)
Expand All @@ -330,7 +330,7 @@ end


local function start_sync_timer(timer_func, delay)
local hdl, err = timer_func(delay, do_sync)
local hdl, err = timer_func(delay, sync_handler)

if not hdl then
return nil, err
Expand Down

0 comments on commit 95e907f

Please sign in to comment.