Browse Source

[CritFix] Neural: Fix keys regression after #3968

tags/3.3
Vsevolod Stakhov 1 year ago
parent
commit
f9cfbba2c8
No account linked to committer's email address
1 changed files with 6 additions and 6 deletions
  1. 6
    6
      lualib/plugins/neural.lua

+ 6
- 6
lualib/plugins/neural.lua View File

local nspam = 0 local nspam = 0
local nham = 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 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 if ret then nham = tonumber(ret) end


return {nspam,nham} return {nspam,nham}
if type(tb) == 'table' and type(tb.redis_key) == 'string' then if type(tb) == 'table' and type(tb.redis_key) == 'string' then
redis.call('DEL', tb.redis_key) redis.call('DEL', tb.redis_key)
-- Also train vectors -- 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 end
end end
local now = tonumber(KEYS[6]) local now = tonumber(KEYS[6])
redis.call('ZADD', KEYS[2], now, KEYS[4]) redis.call('ZADD', KEYS[2], now, KEYS[4])
redis.call('HSET', KEYS[1], 'ann', KEYS[3]) 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[1], 'lock')
redis.call('HDEL', KEYS[7], 'lock') redis.call('HDEL', KEYS[7], 'lock')
redis.call('EXPIRE', KEYS[1], tonumber(KEYS[5])) redis.call('EXPIRE', KEYS[1], tonumber(KEYS[5]))

Loading…
Cancel
Save