diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-11-25 11:10:17 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-11-25 11:10:17 +0000 |
commit | 590949b11bc4ed5c1530b35227fc6fd17cf18dd6 (patch) | |
tree | ba39f4d6347dc5760571c16a73146930274bc2b9 /lualib | |
parent | 4d78f29a7b822231bce8d557f18b644ed5deaf73 (diff) | |
download | rspamd-590949b11bc4ed5c1530b35227fc6fd17cf18dd6.tar.gz rspamd-590949b11bc4ed5c1530b35227fc6fd17cf18dd6.zip |
[Minor] Do not fail on empty limits
Diffstat (limited to 'lualib')
-rw-r--r-- | lualib/rspamadm/fuzzy_stat.lua | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lualib/rspamadm/fuzzy_stat.lua b/lualib/rspamadm/fuzzy_stat.lua index c65a1a477..c5b6ec384 100644 --- a/lualib/rspamadm/fuzzy_stat.lua +++ b/lualib/rspamadm/fuzzy_stat.lua @@ -64,7 +64,12 @@ local function add_data(target, src) end if type(v.extensions.ratelimit) == 'table' then if not target.ratelimit then - target.ratelimit = {} + target.ratelimit = { + cur = { + last = 0, + count = 0 + }, + } end -- Passed as {burst = x, rate = y} target.ratelimit.limit = v.extensions.ratelimit @@ -76,7 +81,7 @@ local function add_data(target, src) cur = { last = 0, count = 0 - } + }, } end -- Ratelimit is passed as {cur = count, last = time} |