jiangfucheng commented on code in PR #9843:
URL: https://github.com/apache/apisix/pull/9843#discussion_r1287123805
##########
apisix/plugins/tencent-cloud-cls/cls-sdk.lua:
##########
@@ -62,8 +62,15 @@ local params_cache = {
local function get_ip(hostname)
local _, resolved = socket.dns.toip(hostname)
local ip_list = {}
- for _, v in ipairs(resolved.ip) do
- insert_tab(ip_list, v)
+ if not resolved.ip then
+ -- DNS parsing failure
+ local err = resolved
+ core.log.warn("resolve ip failed, hostname: " .. hostname .. ", error:
" .. err)
+ insert_tab(ip_list, "127.0.0.1")
Review Comment:
Just want to set a default value to avoid init failure. I moved the init ip
logic to the `send_cls_request` function now, we can return error directly
instead of setting the default value. And, the intention of creating this PR is
that I want to avoid error log when executing other test cases, so I think
moving the init ip logic to `send_cls_request` function is reasonable.
--
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]