From e5e1a434c9d305926ce30bfb1551dc072620d4ef Mon Sep 17 00:00:00 2001
From: Vsevolod Stakhov <vsevolod@highsecure.ru>
Date: Tue, 10 Apr 2018 15:16:24 +0100
Subject: [Minor] Fix return value

---
 src/plugins/lua/ratelimit.lua | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/plugins/lua/ratelimit.lua b/src/plugins/lua/ratelimit.lua
index 446906dd2..466ebafce 100644
--- a/src/plugins/lua/ratelimit.lua
+++ b/src/plugins/lua/ratelimit.lua
@@ -64,7 +64,7 @@ local bucket_check_script = [[
     redis.call('HSET', KEYS[1], 'dr', '10000')
     redis.call('HSET', KEYS[1], 'db', '10000')
     redis.call('EXPIRE', KEYS[1], KEYS[5])
-    return 0
+    return {0, 0, 1, 1}
   end
 
   last = tonumber(last)
@@ -376,8 +376,7 @@ local function ratelimit_cb(task)
     return function(err, data)
       if err then
         rspamd_logger.errx('cannot check limit %s: %s %s', prefix, err, data)
-      end
-      if data and data[1] and data[1] == 1 then
+      elseif type(data) == 'table' and data[1] and data[1] == 1 then
         if settings.info_symbol then
           task:insert_result(settings.info_symbol, 1.0, prefix)
         end
-- 
cgit v1.2.3