aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeftTry <lerest.go@gmail.com>2024-09-29 12:46:30 +0600
committerLeftTry <lerest.go@gmail.com>2024-09-29 12:46:30 +0600
commitee5d923a20ef1f2c09bfb0c71f416591adc2f481 (patch)
treef512b89847b364262fc81c04b6af10e0b8d86585
parent36cceb7c02e9d2020239a8b008b234fc4bd26b48 (diff)
downloadrspamd-ee5d923a20ef1f2c09bfb0c71f416591adc2f481.tar.gz
rspamd-ee5d923a20ef1f2c09bfb0c71f416591adc2f481.zip
[Minor] Change wrong logic of LRU cache to the right one
-rw-r--r--lualib/redis_scripts/ratelimit_check.lua2
1 files changed, 1 insertions, 1 deletions
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