commit ee665b0: [Minor] Minor fixes for previous ratelimit changes

Andrew Lewis nerf at judo.za.org
Tue Jul 25 10:21:03 UTC 2023


Author: Andrew Lewis
Date: 2023-07-24 19:00:36 +0200
URL: https://github.com/rspamd/rspamd/commit/ee665b05d5e6e8f4bd877bf21c805410d9eeed25 (refs/pull/4549/head)

[Minor] Minor fixes for previous ratelimit changes

---
 lualib/redis_scripts/ratelimit_cleanup_pending.lua | 2 +-
 src/plugins/lua/ratelimit.lua                      | 2 +-
 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


More information about the Commits mailing list