From 125f8a161bb135be2da949157f401b6089d03950 Mon Sep 17 00:00:00 2001 From: Nic Date: Wed, 15 Jan 2025 16:26:08 +0800 Subject: [PATCH] fix: race condition problem while update upstream.nodes Signed-off-by: Nic --- apisix/upstream.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apisix/upstream.lua b/apisix/upstream.lua index 3853623e5615..ca45c5995a75 100644 --- a/apisix/upstream.lua +++ b/apisix/upstream.lua @@ -300,10 +300,10 @@ function _M.set_by_route(route, api_ctx) return HTTP_CODE_UPSTREAM_UNAVAILABLE, "invalid nodes format: " .. err end + local new_up_conf = core.table.clone(up_conf) up_conf.nodes = new_nodes up_conf.original_nodes = up_conf.nodes - local new_up_conf = core.table.clone(up_conf) core.log.info("discover new upstream from ", up_conf.service_name, ", type ", up_conf.discovery_type, ": ", core.json.delay_encode(new_up_conf, true))