From 0fa1c80b1d4f962ccf8d24f040c700346ed874f0 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 10 Apr 2018 14:39:07 +0100 Subject: [PATCH] [Minor] Fix rate check code --- src/plugins/lua/ratelimit.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/lua/ratelimit.lua b/src/plugins/lua/ratelimit.lua index 935a4a247..446906dd2 100644 --- a/src/plugins/lua/ratelimit.lua +++ b/src/plugins/lua/ratelimit.lua @@ -403,9 +403,9 @@ local function ratelimit_cb(task) rspamd_logger.debugm(N, task, "check limit %s:%s -> %s (%s/%s)", value.name, pr, value.hash, bucket[2], bucket[1]) lua_redis.exec_redis_script(bucket_check_id, - {task = task, is_write = true}, + {key = value.hash, task = task, is_write = true}, gen_check_cb(pr, bucket, value.name), - {pr.hash, tostring(now), tostring(rate), tostring(bucket[2]), + {value.hash, tostring(now), tostring(rate), tostring(bucket[2]), tostring(settings.expire)}) end end @@ -451,7 +451,7 @@ local function ratelimit_update_cb(task) now = lua_util.round(now * 1000.0) -- Get milliseconds lua_redis.exec_redis_script(bucket_update_id, - {task = task, is_write = true}, + {key = v.hash, task = task, is_write = true}, update_bucket_cb, {v.hash, tostring(now), tostring(mult_rate), tostring(mult_burst), tostring(settings.max_rate_mult), tostring(settings.max_bucket_mult), -- 2.39.5