From 0db49f5e18a82ec126bebbcfd264aa35f19ed231 Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Mon, 12 Sep 2016 18:23:04 +0200 Subject: [PATCH] [Minor] Fix ratelimit rework: don't recycle stale value --- src/plugins/lua/ratelimit.lua | 17 ++++------------- 1 file 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 -- 2.39.5