commit ce6dd7a: [Minor] History_redis: Allow no expire as a valid expire value

Vsevolod Stakhov vsevolod at rspamd.com
Sun May 22 12:00:04 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-05-22 12:55:42 +0100
URL: https://github.com/rspamd/rspamd/commit/ce6dd7ac67d25be0b07a1a8e14ca2b4d04c6b70f (HEAD -> master)

[Minor] History_redis: Allow no expire as a valid expire value

---
 src/plugins/lua/history_redis.lua | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/plugins/lua/history_redis.lua b/src/plugins/lua/history_redis.lua
index 9f8196c1c..b8bd9466a 100644
--- a/src/plugins/lua/history_redis.lua
+++ b/src/plugins/lua/history_redis.lua
@@ -55,7 +55,7 @@ local redis_params
 
 local settings = {
   key_prefix = 'rs_history', -- default key name
-  expire = 0, -- default no expire
+  expire = nil, -- default no expire
   nrows = 200, -- default rows limit
   compress = true, -- use zstd compression when storing data in redis
   subject_privacy = false, -- subject privacy is off
@@ -169,7 +169,7 @@ local function history_save(task)
   if ret then
     conn:add_cmd('LTRIM', {prefix, '0', string.format('%d', settings.nrows-1)})
 
-    if settings.expire > 0 then
+    if settings.expire and settings.expire > 0 then
       conn:add_cmd('EXPIRE', {prefix, string.format('%d', settings.expire)})
     end
   end


More information about the Commits mailing list