Skip to content

Commit f9cfbba

Browse files
committed
[CritFix] Neural: Fix keys regression after #3968
1 parent e872e68 commit f9cfbba

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

lualib/plugins/neural.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ local redis_lua_script_vectors_len = [[
110110
local nspam = 0
111111
local nham = 0
112112
113-
local ret = redis.call('LLEN', prefix .. '_spam')
113+
local ret = redis.call('SCARD', prefix .. '_spam_set')
114114
if ret then nspam = tonumber(ret) end
115-
ret = redis.call('LLEN', prefix .. '_ham')
115+
ret = redis.call('SCARD', prefix .. '_ham_set')
116116
if ret then nham = tonumber(ret) end
117117
118118
return {nspam,nham}
@@ -133,8 +133,8 @@ local redis_lua_script_maybe_invalidate = [[
133133
if type(tb) == 'table' and type(tb.redis_key) == 'string' then
134134
redis.call('DEL', tb.redis_key)
135135
-- Also train vectors
136-
redis.call('DEL', tb.redis_key .. '_spam')
137-
redis.call('DEL', tb.redis_key .. '_ham')
136+
redis.call('DEL', tb.redis_key .. '_spam_set')
137+
redis.call('DEL', tb.redis_key .. '_ham_set')
138138
end
139139
end
140140
end
@@ -181,8 +181,8 @@ local redis_lua_script_save_unlock = [[
181181
local now = tonumber(KEYS[6])
182182
redis.call('ZADD', KEYS[2], now, KEYS[4])
183183
redis.call('HSET', KEYS[1], 'ann', KEYS[3])
184-
redis.call('DEL', KEYS[1] .. '_spam')
185-
redis.call('DEL', KEYS[1] .. '_ham')
184+
redis.call('DEL', KEYS[1] .. '_spam_set')
185+
redis.call('DEL', KEYS[1] .. '_ham_set')
186186
redis.call('HDEL', KEYS[1], 'lock')
187187
redis.call('HDEL', KEYS[7], 'lock')
188188
redis.call('EXPIRE', KEYS[1], tonumber(KEYS[5]))

0 commit comments

Comments
 (0)