Skip to content

Commit

Permalink
rename funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
chronolaw committed Nov 18, 2024
1 parent ccca7ba commit d1236b3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions kong/clustering/services/sync/rpc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ end


-- version has a prefix "XX", like "XX000001"
local function format_lmdb_version(ver)
local function format_sync_version(ver)
return fmt("XX%030d", ver)
end


local function get_lmdb_version()
local function get_sync_version()
local str = declarative.get_current_hash()
if not str then
return 0
Expand Down Expand Up @@ -104,7 +104,7 @@ function _M:init_cp(manager)
ip = kong.rpc:get_peer_ip(node_id), -- try to get the correct ip
version = "3.8.0.0", -- XXX TODO: get from rpc call
sync_status = CLUSTERING_SYNC_STATUS.NORMAL,
config_hash = format_lmdb_version(default_namespace_version),
config_hash = format_sync_version(default_namespace_version),
rpc_capabilities = rpc_peers and rpc_peers[node_id] or {},
}, { ttl = purge_delay, no_broadcast_crud_event = true, })
if not ok then
Expand Down Expand Up @@ -179,7 +179,7 @@ function _M:init_dp(manager)
return nil, "'new_version' key does not exist"
end

local lmdb_ver = get_lmdb_version()
local lmdb_ver = get_sync_version()
if lmdb_ver < version then
return self:sync_once()
end
Expand All @@ -201,7 +201,7 @@ end
local function do_sync()
local ns_deltas, err = kong.rpc:call("control_plane", "kong.sync.v2.get_delta",
{ default =
{ version = get_lmdb_version(),
{ version = get_sync_version(),
},
})
if not ns_deltas then
Expand Down Expand Up @@ -337,7 +337,7 @@ local function do_sync()
end -- for _, delta

-- store current sync version
t:set(DECLARATIVE_HASH_KEY, format_lmdb_version(version))
t:set(DECLARATIVE_HASH_KEY, format_sync_version(version))

-- store the correct default workspace uuid
if default_ws_changed then
Expand Down

0 comments on commit d1236b3

Please sign in to comment.