jizhuozhi commented on code in PR #12448:
URL: https://github.com/apache/apisix/pull/12448#discussion_r2261859866
##########
apisix/discovery/consul/init.lua:
##########
@@ -511,11 +515,19 @@ function _M.connect(premature, consul_server, retry_delay)
local nodes = up_services[service_name]
local nodes_uniq = {}
for _, node in ipairs(result.body) do
- if not node.Service then
+ local service = node.Service
+ if not service then
goto CONTINUE
end
- local svc_address, svc_port = node.Service.Address,
node.Service.Port
+ local svc_address = service.Address
+ local svc_port = service.Port
+ local metadata = service.Meta
+ -- ensure that metadata is an accessible table,
+ -- avoid userdata likes `null` returned by cjson
+ if type(metadata) ~= "table" then
Review Comment:
Hello @membphis. I will add cdata check and error log, but I am not sure
whether it is appropriate to skip this node.
If it is a container template release, it means that all the containers
released in this batch will be skipped, and users only need to pay attention to
whether it is valid when they need to use metadata. If it is skipped directly,
the service quality will be affected. So I tend to keep these nodes, print logs
and leave them empty.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]