]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Ratelimit: Custom limits: Pass task to get_limit
authorAndrew Lewis <nerf@judo.za.org>
Sun, 9 Jul 2017 11:39:03 +0000 (13:39 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Sun, 9 Jul 2017 11:39:03 +0000 (13:39 +0200)
src/plugins/lua/ratelimit.lua

index beb9eb283b1c9a4c860ac5e9475e970e3fdc4e70..2c42c28769973a4c15cc94f8acdedcac86625098 100644 (file)
@@ -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