Skip to content

Commit

Permalink
fix(sync): extend wait time for RPC layer initialization (#13939)
Browse files Browse the repository at this point in the history
When we start up DP, we need to make a meta call to CP first, so the first `do_sync` during the initial sync fails. It reports an ERR error: `rpc.lua:432: unable to create worker mutex and sync: rpc is not ready`. This experience is not ideal.

The initialization of the configuration also fails, and we have to wait for ourselves to wait 30 seconds (`sync_every(30s)`) before the configuration can sync successfully. This means that the DP will be unable to function for a period of time after connecting.

https://konghq.atlassian.net/browse/KAG-5922
  • Loading branch information
chobits authored and ProBrian committed Dec 13, 2024
1 parent 34ac92c commit 50bf509
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kong/clustering/services/sync/rpc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ end

-- check if rpc connection is ready
local function is_rpc_ready()
for i = 1, 5 do
-- TODO: find a better way to detect when the RPC layer, including caps list,
-- has been fully initialized, instead of waiting for up to 5.5 seconds
for i = 1, 10 do
local res = kong.rpc:get_peers()

-- control_plane is ready
Expand Down

0 comments on commit 50bf509

Please sign in to comment.