Fabriceli commented on code in PR #8651:
URL: https://github.com/apache/apisix/pull/8651#discussion_r1073110176


##########
apisix/discovery/consul/init.lua:
##########
@@ -242,48 +215,76 @@ function _M.connect(premature, consul_server, retry_delay)
 
     -- if current index different last index then update service
     if consul_server.index ~= watch_result.headers['X-Consul-Index'] then
+        local up_services = core.table.new(0, #watch_result.body)
+        local consul_client_svc = resty_consul:new({
+            host = consul_server.host,
+            port = consul_server.port,
+            connect_timeout = consul_server.connect_timeout,
+            read_timeout = consul_server.read_timeout,
+        })
+        for service_name, _ in pairs(watch_result.body) do
+            -- check if the service_name is 'skip service'
+            if skip_service_map[service_name] then
+                goto CONTINUE
+            end
+            -- get node from service
+            local svc_url = consul_server.consul_sub_url .. "/" .. service_name
+            local result, err = consul_client_svc:get(svc_url)
+            local error_info = (err ~= nil and err) or
+                    ((result ~= nil and result.status ~= 200) and 
result.status)
+            if error_info then
+                log.error("connect consul: ", consul_server.consul_server_url,
+                        " by svc url: ", svc_url, ", with error: ", error_info)

Review Comment:
   done



-- 
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: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to