]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Fix ratelimit rework: don't recycle stale value 946/head
authorAndrew Lewis <nerf@judo.za.org>
Mon, 12 Sep 2016 16:23:04 +0000 (18:23 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Mon, 12 Sep 2016 16:23:04 +0000 (18:23 +0200)
src/plugins/lua/ratelimit.lua

index a360123507d694444077f1c5c4e89bfa819c9574..0736c7c3b04999fe4bd7ea706d756cc4406d02f8 100644 (file)
@@ -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