From ee5d923a20ef1f2c09bfb0c71f416591adc2f481 Mon Sep 17 00:00:00 2001 From: LeftTry Date: Sun, 29 Sep 2024 12:46:30 +0600 Subject: [Minor] Change wrong logic of LRU cache to the right one --- lualib/redis_scripts/ratelimit_check.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lualib/redis_scripts') diff --git a/lualib/redis_scripts/ratelimit_check.lua b/lualib/redis_scripts/ratelimit_check.lua index f066610a5..f8e34bbf7 100644 --- a/lualib/redis_scripts/ratelimit_check.lua +++ b/lualib/redis_scripts/ratelimit_check.lua @@ -86,7 +86,7 @@ if burst + pending > 0 then burst = burst + pending if burst > 0 and burst > max_burst * dynb then redis.call('ZREMRANGEBYRANK', cache_prefix, 0, -(max_cache_size + 1)) - redis.call('ZINCRBY', cache_prefix, 1, prefix) + redis.call('ZADD', cache_prefix, now, prefix) -- LRU cache is based on timestamps of buckets return { 1, tostring(burst - pending), tostring(dynr), tostring(dynb), tostring(leaked) } end -- cgit v1.2.3