You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/12/23 13:57:39 UTC

[GitHub] [apisix] gxthrj commented on a change in pull request #5881: feat(limit-count): allow sharing counter

gxthrj commented on a change in pull request #5881:
URL: https://github.com/apache/apisix/pull/5881#discussion_r774587145



##########
File path: apisix/plugins/limit-count.lua
##########
@@ -192,7 +248,12 @@ function _M.access(conf, ctx)
         key = ctx.var["remote_addr"]
     end
 
-    key = key .. ctx.conf_type .. ctx.conf_version
+    if not conf.group then
+        key = key .. ctx.conf_type .. ctx.conf_version
+    else
+        key = key .. conf.group

Review comment:
       So traffic will eventually be limited according to the key generated by the combination of key and group.
   But `key` can not be empty (if `key` is empty, `remote_addr` will be set as the default key), 
   so it is never possible to limit the rate only according to the `group`.




-- 
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: notifications-unsubscribe@apisix.apache.org

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