aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-09-12 17:35:50 +0100
committerGitHub <noreply@github.com>2016-09-12 17:35:50 +0100
commitd44c6438bd48f1e772fe975bcbd9fedb27a1caf9 (patch)
treeff450e9fa8d9f9fe061223a046f6bb807aaec785 /src/plugins/lua
parent5a4f977323346cda73cd780a469ca7cbbce45225 (diff)
parent0db49f5e18a82ec126bebbcfd264aa35f19ed231 (diff)
downloadrspamd-d44c6438bd48f1e772fe975bcbd9fedb27a1caf9.tar.gz
rspamd-d44c6438bd48f1e772fe975bcbd9fedb27a1caf9.zip
Merge pull request #946 from fatalbanana/rlimit3
[Minor] Fix ratelimit rework: don't recycle stale value
Diffstat (limited to 'src/plugins/lua')
-rw-r--r--src/plugins/lua/ratelimit.lua17
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