spacewander commented on a change in pull request #4575:
URL: https://github.com/apache/apisix/pull/4575#discussion_r666751327



##########
File path: apisix/admin/proto.lua
##########
@@ -117,25 +117,31 @@ function _M.post(id, conf)
     return res.status, res.body
 end
 
-function _M.check_proto_used(plugins, deleting, ptype, pid)
+local function check_proto_used(plugins, deleting, ptype, pid)
 
-    core.log.info("plugins1: ", core.json.delay_encode(plugins, true))
+    core.log.info("check_proto_used plugins: ", 
core.json.delay_encode(plugins, true))
+    core.log.info("check_proto_used deleting: ", deleting)
+    core.log.info("check_proto_used ptype: ", ptype)
+    core.log.info("check_proto_used pid: ", pid)
 
     if plugins then
         if type(plugins) == "table" and plugins["grpc-transcode"]
            and plugins["grpc-transcode"].proto_id
            and tostring(plugins["grpc-transcode"].proto_id) == deleting then
-            return 400, {error_msg = "can not delete this proto,"
+            --core.log.info("check_proto_used 此协议正在使用: ", 
core.json.delay_encode(plugins, true))

Review comment:
       Please remove commented code

##########
File path: apisix/admin/proto.lua
##########
@@ -144,13 +150,16 @@ function _M.delete(id)
 
     if routes_ver and routes then
         for _, route in ipairs(routes) do
-            if type(route) == "table" and route.value
-               and route.value.plugins then
-                  return _M.check_proto_used(route.value.plugins, id, "route",
-                                             route.value.id)
+            core.log.info("proto delete route item: ", 
core.json.delay_encode(route, true))
+            if type(route) == "table" and route.value and route.value.plugins 
then
+                   local ret, err = check_proto_used(route.value.plugins, id, 
"route",route.value.id)

Review comment:
       Bad indent
   Also, need space after ','




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