diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-06-27 20:45:39 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-06-27 20:45:39 +0100 |
commit | f9cfbba2c84e01f18e65618587e6854681843ff1 (patch) | |
tree | c3f063fc17c786dcfbb526e043d5473b41b5d75c /lualib/plugins | |
parent | e872e68c0de7443592bc50cac6f484a1ce41a038 (diff) | |
download | rspamd-f9cfbba2c84e01f18e65618587e6854681843ff1.tar.gz rspamd-f9cfbba2c84e01f18e65618587e6854681843ff1.zip |
[CritFix] Neural: Fix keys regression after #3968
Diffstat (limited to 'lualib/plugins')
-rw-r--r-- | lualib/plugins/neural.lua | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lualib/plugins/neural.lua b/lualib/plugins/neural.lua index 67051fa1a..7c16fa617 100644 --- a/lualib/plugins/neural.lua +++ b/lualib/plugins/neural.lua @@ -110,9 +110,9 @@ local redis_lua_script_vectors_len = [[ local nspam = 0 local nham = 0 - local ret = redis.call('LLEN', prefix .. '_spam') + local ret = redis.call('SCARD', prefix .. '_spam_set') if ret then nspam = tonumber(ret) end - ret = redis.call('LLEN', prefix .. '_ham') + ret = redis.call('SCARD', prefix .. '_ham_set') if ret then nham = tonumber(ret) end return {nspam,nham} @@ -133,8 +133,8 @@ local redis_lua_script_maybe_invalidate = [[ if type(tb) == 'table' and type(tb.redis_key) == 'string' then redis.call('DEL', tb.redis_key) -- Also train vectors - redis.call('DEL', tb.redis_key .. '_spam') - redis.call('DEL', tb.redis_key .. '_ham') + redis.call('DEL', tb.redis_key .. '_spam_set') + redis.call('DEL', tb.redis_key .. '_ham_set') end end end @@ -181,8 +181,8 @@ local redis_lua_script_save_unlock = [[ local now = tonumber(KEYS[6]) redis.call('ZADD', KEYS[2], now, KEYS[4]) redis.call('HSET', KEYS[1], 'ann', KEYS[3]) - redis.call('DEL', KEYS[1] .. '_spam') - redis.call('DEL', KEYS[1] .. '_ham') + redis.call('DEL', KEYS[1] .. '_spam_set') + redis.call('DEL', KEYS[1] .. '_ham_set') redis.call('HDEL', KEYS[1], 'lock') redis.call('HDEL', KEYS[7], 'lock') redis.call('EXPIRE', KEYS[1], tonumber(KEYS[5])) |