membphis commented on code in PR #8113:
URL: https://github.com/apache/apisix/pull/8113#discussion_r998846211


##########
apisix/core/ai.lua:
##########
@@ -48,10 +66,39 @@ local function ai_match(ctx)
 end
 
 
+local function gen_get_cache_key_func(route_flags)
+    if get_cache_key_func_def_render == nil then
+        local template = require("resty.template")
+        get_cache_key_func_def_render = 
template.compile(get_cache_key_func_def)
+    end
+
+    local str = get_cache_key_func_def_render({route_flags = route_flags})
+    local func, err = loadstring(str)
+    if func == nil then
+        return err

Review Comment:
   oh my god, this is not a good design.
   
   we should use `return false, err`, the error message can be ignore in some 
case



##########
apisix/core/ai.lua:
##########
@@ -71,6 +118,12 @@ function  _M.routes_analyze(routes)
     else
         core.log.info("use ai plane to match route")
         router.match = ai_match
+
+        local err = gen_get_cache_key_func(route_flags)

Review Comment:
   ditto



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