From: Andrew Lewis Date: Sun, 9 Jul 2017 11:39:03 +0000 (+0200) Subject: [Minor] Ratelimit: Custom limits: Pass task to get_limit X-Git-Tag: 1.6.3~3^2~6 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=aba512c1a7623a0f909219fbe55740f56d992227;p=rspamd.git [Minor] Ratelimit: Custom limits: Pass task to get_limit --- diff --git a/src/plugins/lua/ratelimit.lua b/src/plugins/lua/ratelimit.lua index beb9eb283..2c42c2876 100644 --- a/src/plugins/lua/ratelimit.lua +++ b/src/plugins/lua/ratelimit.lua @@ -509,7 +509,7 @@ local function rate_test_set(task, func) table.insert(args, {settings[k], rk}) elseif type(settings[k]) == 'string' and (custom_keywords[settings[k]] and type(custom_keywords[settings[k]]['get_limit']) == 'function') then - local res = custom_keywords[settings[k]]['get_limit']() + local res = custom_keywords[settings[k]]['get_limit'](task) if type(res) == 'table' then table.insert(args, {res, rate_key}) elseif type(res) == 'string' then @@ -525,7 +525,7 @@ local function rate_test_set(task, func) table.insert(args, {settings[k], rate_key}) elseif type(settings[k]) == 'string' and (custom_keywords[settings[k]] and type(custom_keywords[settings[k]]['get_limit']) == 'function') then - local res = custom_keywords[settings[k]]['get_limit']() + local res = custom_keywords[settings[k]]['get_limit'](task) if type(res) == 'table' then table.insert(args, {res, rate_key}) elseif type(res) == 'string' then