diff options
author | Andrew Lewis <nerf@judo.za.org> | 2016-09-12 18:23:04 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2016-09-12 18:23:04 +0200 |
commit | 0db49f5e18a82ec126bebbcfd264aa35f19ed231 (patch) | |
tree | 88e8e92e8a184180865779c88a076f4e62553887 /src | |
parent | 18057a3c05af3261f277e153360d63542c43f976 (diff) | |
download | rspamd-0db49f5e18a82ec126bebbcfd264aa35f19ed231.tar.gz rspamd-0db49f5e18a82ec126bebbcfd264aa35f19ed231.zip |
[Minor] Fix ratelimit rework: don't recycle stale value
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/lua/ratelimit.lua | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/plugins/lua/ratelimit.lua b/src/plugins/lua/ratelimit.lua index a36012350..0736c7c3b 100644 --- a/src/plugins/lua/ratelimit.lua +++ b/src/plugins/lua/ratelimit.lua @@ -164,19 +164,10 @@ local function dynamic_rate_key(task, rtype) if not keywords[v]['condition']() then return nil end end local ret - if custom_keywords[v] and custom_keywords[v]['value'] then - ret = custom_keywords[v]['value'] - elseif keywords[v] and keywords[v]['value'] then - ret = keywords[v]['value'] - end - if not ret then - if custom_keywords[v] and type(custom_keywords[v]['get_value']) == 'function' then - ret = custom_keywords[v]['get_value'](task) - if ret then custom_keywords[v]['value'] = ret end - elseif keywords[v] and type(keywords[v]['get_value']) == 'function' then - ret = keywords[v]['get_value'](task) - if ret then keywords[v]['value'] = ret end - end + if custom_keywords[v] and type(custom_keywords[v]['get_value']) == 'function' then + ret = custom_keywords[v]['get_value'](task) + elseif keywords[v] and type(keywords[v]['get_value']) == 'function' then + ret = keywords[v]['get_value'](task) end if not ret then return nil end if v == 'to' then have_to = true end |