wbaweto opened a new issue #2098:
URL: https://github.com/apache/apisix/issues/2098


   ### Issue description
   route use limit-count plugin, update again plugin config info not effective
   
   ### Environment
   
   * apisix version (cmd: `apisix version`): 1.5
   * OS:  CentOS Linux release 7.6.1810 (Core)
   
   ### Minimal test code / Steps to reproduce the issue
   1. route config type
   route -> service -> upstream
   {
       "uri": "/v1/test/get",
       "hosts": ["api-dev.test.com"],
       "priority": 10,
       "methods": ["GET", "POST", "OPTIONS", "HEAD"],
       "plugins": {
           "limit-count": {
               "count": 10,
               "time_window": 3,
               "rejected_code": 403,
               "key": "remote_addr"
           }
       },
       "service_id": "test"
   }
   2. update again plugin config info
   modify imit-count.count from 10 to 20
   {
       "uri": "/v1/test/get",
       "hosts": ["api-dev.test.com"],
       "priority": 10,
       "methods": ["GET", "POST", "OPTIONS", "HEAD"],
       "plugins": {
           "limit-count": {
               "count": 20,
               "time_window": 3,
               "rejected_code": 403,
               "key": "remote_addr"
           }
       },
       "service_id": "test"
   }
   
   ### What's the actual result? (including assertion message & call stack if 
applicable)
   1、initial config limit-count,  response head. expected result, is right
   Apisix-Plugins: limit-count
   X-RateLimit-Limit: 10
   X-RateLimit-Remaining: 9
   
   2、update again limit-count info,  response head. unexpected result, is wrong
   Apisix-Plugins: limit-count
   X-RateLimit-Limit: 20
   X-RateLimit-Remaining: 9
   
   X-RateLimit-Remaining result is wrong, expected result: 19
   
   ### Reason positioning
   1、apisix/plugins/limit-count.lua:
   local lim, err = core.lrucache.plugin_ctx(plugin_name, ctx, 
create_limit_obj, conf)
   
   2、apisix/core/lrucache.lua
   function _M.plugin_ctx(plugin_name, api_ctx, create_obj_fun, ...)
       local key = api_ctx.conf_type .. "#" .. api_ctx.conf_id
       return _plugin(plugin_name, key, api_ctx.conf_version, create_obj_fun, 
...)
   end
   
   api_ctx.conf_type value: service
   api_ctx.conf_id value: test
   api_ctx.conf_version -> service_id=test version ID
   
   no matter how update route's limit-count info,  
api_ctx.conf_type、api_ctx.conf_id、api_ctx.conf_version is unchanged, 
   limit-count info always get the initial value


----------------------------------------------------------------
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:
[email protected]


Reply via email to