arthur-zhang commented on a change in pull request #4558:
URL: https://github.com/apache/apisix/pull/4558#discussion_r665814650



##########
File path: apisix/api_router.lua
##########
@@ -89,13 +89,20 @@ function fetch_api_router()
             core.log.debug("fetched api routes: ",
                            core.json.delay_encode(api_routes, true))
             for _, route in ipairs(api_routes) do
+                if has_route_not_under_apisix then
+                    break
+                end
                 local typ_uri = type(route.uri)
                 if typ_uri == "string" then
-                    has_route_not_under_apisix =
-                        not core.string.has_prefix(route.uri, "/apisix/")
+                    if not core.string.has_prefix(route.uri, "/apisix/") then
+                        has_route_not_under_apisix = true
+                    end
                 else
                     for _, uri in ipairs(route.uri) do
-                        if not core.string.has_prefix(route.uri, "/apisix/") 
then
+                        if has_route_not_under_apisix then
+                            break
+                        end
+                        if not core.string.has_prefix(uri, "/apisix/") then
                             has_route_not_under_apisix = true

Review comment:
       Good suggestion




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