kingluo commented on code in PR #9334:
URL: https://github.com/apache/apisix/pull/9334#discussion_r1196113194


##########
apisix/router.lua:
##########
@@ -22,34 +22,147 @@ local plugin_checker = 
require("apisix.plugin").plugin_checker
 local str_lower = string.lower
 local error   = error
 local ipairs  = ipairs
-
+local sub_str      = string.sub
+local table        = require("apisix.core.table")
+local json         = require("apisix.core.json")
 
 local _M = {version = 0.3}
 
+local function short_key(self, str)
+    return sub_str(str, #self.key + 2)
+end
 
-local function filter(route)
+local function filter(route, pre_route_obj, size)

Review Comment:
   The function prototype is too obscure, `pre_route_obj` may contain different 
types. It's better to split the radix tree reconstruction into another 
function, e.g. `filter_all_routes`.



##########
apisix/router.lua:
##########
@@ -84,6 +198,7 @@ function _M.http_init_worker()
     local router_http = require("apisix.http.router." .. router_http_name)
     attach_http_router_common_methods(router_http)
     router_http.init_worker(filter)
+

Review Comment:
   extra blank line?



##########
apisix/router.lua:
##########
@@ -70,6 +183,7 @@ local function attach_http_router_common_methods(http_router)
     end
 end
 
+local uri_routes = {}

Review Comment:
   dead code?



##########
apisix/http/router/radixtree_uri.lua:
##########
@@ -17,33 +17,15 @@
 local require = require
 local core = require("apisix.core")
 local base_router = require("apisix.http.route")
-local get_services = require("apisix.http.service").services
-local cached_router_version
-local cached_service_version
+local router = require("apisix.router")
 
 
 local _M = {version = 0.2}
 
 
-    local uri_routes = {}
-    local uri_router
     local match_opts = {}
 function _M.match(api_ctx)
     local user_routes = _M.user_routes

Review Comment:
   should be removed too?



##########
apisix/router.lua:
##########
@@ -22,34 +22,147 @@ local plugin_checker = 
require("apisix.plugin").plugin_checker
 local str_lower = string.lower
 local error   = error
 local ipairs  = ipairs
-
+local sub_str      = string.sub
+local table        = require("apisix.core.table")
+local json         = require("apisix.core.json")
 
 local _M = {version = 0.3}
 
+local function short_key(self, str)
+    return sub_str(str, #self.key + 2)
+end
 
-local function filter(route)
+local function filter(route, pre_route_obj, size)
     route.orig_modifiedIndex = route.modifiedIndex
-    route.update_count = 0
+    route.update_count = 0 

Review Comment:
   extra space.



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