bzp2010 commented on code in PR #12187:
URL: https://github.com/apache/apisix/pull/12187#discussion_r2125563602


##########
apisix/upstream.lua:
##########
@@ -297,7 +297,12 @@ function _M.set_by_route(route, api_ctx)
             return 503, err
         end
 
-        local new_nodes, err = dis.nodes(up_conf.service_name, 
up_conf.discovery_args)
+        local service_name, err = core.utils.resolve_var(up_conf.service_name, 
api_ctx.var)
+        if not service_name or service_name == "" then
+            return 503, "service_name is empty: " .. (err or "nil")

Review Comment:
   It is best to use a meaningful fallback value, such as `resolve_var resolves 
to empty string`.



##########
t/core/utils.t:
##########
@@ -393,3 +393,5 @@ res:nil
 res:5
 res:12
 res:7
+
+

Review Comment:
   This doesn't seem to make sense? Don't modify the code style, which causes 
Code Lint to fail.



-- 
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]

Reply via email to