Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions apisix/discovery/nacos/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ local error = error
local math_random = math.random
local ngx = ngx
local ngx_timer_at = ngx.timer.at
local process = require("ngx.process")
local log = core.log

local _M = {}
Expand Down Expand Up @@ -291,6 +292,10 @@ function _M.init_worker()
return
end

if process.type() ~= "privileged agent" then
return
end
Comment on lines +295 to +297
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new privileged-agent guard changes runtime behavior (workers no longer fetch/refresh Nacos data themselves). There are existing Nacos discovery tests under t/discovery/, but none assert that fetching happens only in the privileged agent (or that workers don’t start the fetch timer). Please add a regression test that fails if non-privileged workers perform Nacos fetches (e.g., by asserting request counts/log lines or by using worker_processes > 1 and verifying only one periodic fetch).

Copilot uses AI. Check for mistakes.

-- shallow copy to avoid mutating cached config
local conf = {}
for k, v in pairs(nacos_conf) do
Expand Down
Loading