From: LeftTry Date: Sun, 29 Sep 2024 06:46:30 +0000 (+0600) Subject: [Minor] Change wrong logic of LRU cache to the right one X-Git-Tag: 3.11.0~32^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee5d923a20ef1f2c09bfb0c71f416591adc2f481;p=thirdparty%2Frspamd.git [Minor] Change wrong logic of LRU cache to the right one --- diff --git a/lualib/redis_scripts/ratelimit_check.lua b/lualib/redis_scripts/ratelimit_check.lua index f066610a54..f8e34bbf72 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