spacewander commented on code in PR #8651:
URL: https://github.com/apache/apisix/pull/8651#discussion_r1067752332
##########
t/discovery/consul_dump.t:
##########
@@ -161,6 +165,8 @@ discovery:
consul:
servers:
- "http://127.0.0.1:38500"
+ skip_services:
+ - "consul"
Review Comment:
Do we need to add it as the default value?
##########
t/discovery/consul_dump.t:
##########
@@ -75,9 +75,11 @@ discovery:
consul:
servers:
- "http://127.0.0.1:8500"
+ skip_services:
+ - "consul"
dump:
path: "consul.dump"
- load_on_init: true
+ load_on_init: false
Review Comment:
Why change this value?
##########
apisix/discovery/consul/init.lua:
##########
@@ -237,53 +208,80 @@ function _M.connect(premature, consul_server, retry_delay)
log.info("connect consul: ", consul_server.consul_server_url,
", watch_result status: ", watch_result.status,
", watch_result.headers.index: ",
watch_result.headers['X-Consul-Index'],
- ", consul_server.index: ", consul_server.index,
- ", consul_server: ", json_delay_encode(consul_server, true))
+ ", consul_server.index: ", consul_server.index)
-- 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 is skip service
Review Comment:
```suggestion
-- check if the service_name is 'skip service'
```
##########
apisix/discovery/consul/init.lua:
##########
@@ -237,53 +208,80 @@ function _M.connect(premature, consul_server, retry_delay)
log.info("connect consul: ", consul_server.consul_server_url,
", watch_result status: ", watch_result.status,
", watch_result.headers.index: ",
watch_result.headers['X-Consul-Index'],
- ", consul_server.index: ", consul_server.index,
- ", consul_server: ", json_delay_encode(consul_server, true))
+ ", consul_server.index: ", consul_server.index)
Review Comment:
Would you get rid of the 8 spaces indentation in the new code?
##########
apisix/discovery/consul/init.lua:
##########
@@ -237,53 +208,80 @@ function _M.connect(premature, consul_server, retry_delay)
log.info("connect consul: ", consul_server.consul_server_url,
", watch_result status: ", watch_result.status,
", watch_result.headers.index: ",
watch_result.headers['X-Consul-Index'],
- ", consul_server.index: ", consul_server.index,
- ", consul_server: ", json_delay_encode(consul_server, true))
+ ", consul_server.index: ", consul_server.index)
-- 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,
Review Comment:
Missing default_args?
--
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]