From 0a5cdf2f228c153a41fa706d90dd04861121a273 Mon Sep 17 00:00:00 2001 From: ADD-SP Date: Thu, 26 Dec 2024 03:20:37 +0000 Subject: [PATCH] fix(runloop): skip router rebuilding if reconfigure is running --- kong/runloop/handler.lua | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/kong/runloop/handler.lua b/kong/runloop/handler.lua index 54eb8cf0ba30..be3e8c228578 100644 --- a/kong/runloop/handler.lua +++ b/kong/runloop/handler.lua @@ -990,8 +990,30 @@ return { if strategy ~= "off" or kong.sync then local worker_state_update_frequency = kong.configuration.worker_state_update_frequency or 1 + --[[ + +-----------+ + | Start | <-------------------------------------+ + +-----------+ | + | | + | | + v | | + *************************** +-------+ | + * Is reconfigure running? * ---Yes--->| Sleep | ----+ + *************************** +-------+ + | ^ + No | + | | + v | + +---------------+ | + | rebuild router|-------------------------+ + +---------------+ + + Since reconfigure will also rebuild the router, we skip this round + of rebuilding the router. + --]] local router_async_opts = { - name = "router", + name = RECONFIGURE_OPTS and RECONFIGURE_OPTS.name or "router", -- please check the above diagram for the + -- reason of using the same name as reconfigure timeout = 0, on_timeout = "return_true", }