From 50bf509fe9e38db1301695386f85e72a0dc978ba Mon Sep 17 00:00:00 2001 From: Xiaochen Wang Date: Fri, 29 Nov 2024 13:57:29 +0800 Subject: [PATCH] fix(sync): extend wait time for RPC layer initialization (#13939) 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 --- kong/clustering/services/sync/rpc.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kong/clustering/services/sync/rpc.lua b/kong/clustering/services/sync/rpc.lua index 0b6970e4c2f71..0a42fc8b1c6f7 100644 --- a/kong/clustering/services/sync/rpc.lua +++ b/kong/clustering/services/sync/rpc.lua @@ -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