aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-07-25 11:16:38 +0100
committerGitHub <noreply@github.com>2023-07-25 11:16:38 +0100
commit5a23ddde8da6f63ee2a1438396e9270a780c21dd (patch)
tree8dcd264e3fc51222de700dd206e78eb0b0c6d0b2
parent0d8cabe1e157902481bf76014d56de18d3204d08 (diff)
parentee665b05d5e6e8f4bd877bf21c805410d9eeed25 (diff)
downloadrspamd-5a23ddde8da6f63ee2a1438396e9270a780c21dd.tar.gz
rspamd-5a23ddde8da6f63ee2a1438396e9270a780c21dd.zip
Merge pull request #4549 from fatalbanana/ratelimit
[Minor] Minor fixes for previous ratelimit changes
-rw-r--r--lualib/redis_scripts/ratelimit_cleanup_pending.lua2
-rw-r--r--src/plugins/lua/ratelimit.lua2
2 files changed, 2 insertions, 2 deletions
diff --git a/lualib/redis_scripts/ratelimit_cleanup_pending.lua b/lualib/redis_scripts/ratelimit_cleanup_pending.lua
index f51599b09..67ae634f1 100644
--- a/lualib/redis_scripts/ratelimit_cleanup_pending.lua
+++ b/lualib/redis_scripts/ratelimit_cleanup_pending.lua
@@ -22,7 +22,7 @@ pending = tonumber(pending or '0')
if pending < nrcpt then pending = 0 else pending = pending - nrcpt end
-- 3. Set the updated values back to Redis and update the expiration time for the bucket
-redis.call('HMSET', prefix, tostring(pending), 'l', KEYS[2])
+redis.call('HMSET', prefix, 'p', tostring(pending), 'l', KEYS[2])
redis.call('EXPIRE', prefix, KEYS[3])
-- 4. Return the updated pending value
diff --git a/src/plugins/lua/ratelimit.lua b/src/plugins/lua/ratelimit.lua
index e2e4e6887..b225d0650 100644
--- a/src/plugins/lua/ratelimit.lua
+++ b/src/plugins/lua/ratelimit.lua
@@ -544,7 +544,7 @@ local function maybe_cleanup_pending(task)
if task:cache_get('ratelimit_bucket_touched') then
local prefixes = task:cache_get('ratelimit_prefixes')
if prefixes then
- for k, v in pairs(prefixes) or E do
+ for k, v in pairs(prefixes) do
local bucket = v.bucket
local function cleanup_cb(err, data)
if err then