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



##########
File path: apisix/plugins/limit-count/limit-count-redis-cluster.lua
##########
@@ -32,7 +32,7 @@ local mt = {
 
 local function new_redis_cluster(conf)
     local config = {
-        name = "apisix-redis-cluster",
+        name = "apisix-redis-cluster-" .. conf.name,

Review comment:
       I read through the `resty.rediscluster`. Look like this library uses a 
module-level `slot_cache`, and the key is the `config.name`.
   
   So it is no doubted that different configurations with the same name will 
collide.
   
   ~~What about using `"apisix-redis-cluster-" .. tostring(conf)` directly?~~
   Better to add a comment about this change as future maintainers may not read 
through the library. 
   
   ~~Different routes using the same cluster will still need to share the 
slot_cache. Would it be better to use crc32(nodes) to generate the suffix?~~
   
   Sorry for my fickle mind. It seems the library doesn't provide a way to 
clean up stale cached slots. So using auto-generated name is unsafe. My latest 
idea is to require user to specify the name of redis cluster. It is a break 
change but it is reasonable to introduce break change to fix bug.




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