membphis commented on pull request #2158:
URL: https://github.com/apache/apisix/pull/2158#issuecomment-686875823


   we'll get the wrong route list in APISIX by this case:
   
   ```shell
   ETCDCTL_API=2 etcdctl rm -r /apisix && make init
   
   make run
   
   curl -i http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "uri": "/route",
       "plugins": {
           "serverless-pre-function": {
               "phase": "rewrite",
               "functions" : ["return function() local router = 
require(\"apisix.http.router.radixtree_host_uri\")\nlocal routes, routes_ver = 
router.routes()\n\nlocal core = require(\"apisix.core\")\nngx.say(\"worker_pid: 
\", ngx.worker.pid())\nngx.say(\"route_ver: \", 
routes_ver)\nngx.say(\"routes_type: \", type(routes))\n\nlocal keys = {}\nfor 
key in pairs(routes) do\n    table.insert(keys, 
key)\nend\n\ntable.sort(keys)\n\nfor _, key in ipairs(keys) do\n    
ngx.say(\"--> key: \", key)\n    ngx.say(\"--> val: \", 
core.json.encode(routes[key], true))\nend\n end"]
           }
       }
   }'
   
   curl http://127.0.0.1:9080/route -i
   
   # 200 routes
   bash -x create && bash -x delete && bash -x create
   
   curl http://127.0.0.1:9080/route -i
   
   make stop
   ```


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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to