local vec = neural_common.result_to_vector(task, set)
local str = rspamd_util.zstd_compress(table.concat(vec, ';'))
- local target_key = set.ann.redis_key .. '_' .. learn_type
+ local target_key = set.ann.redis_key .. '_' .. learn_type .. '_set'
local function learn_vec_cb(_err)
if _err then
nil,
true, -- is write
learn_vec_cb, --callback
- 'LPUSH', -- command
+ 'SADD', -- command
{ target_key, str } -- arguments
)
else
nil,
false, -- is write
redis_ham_cb, --callback
- 'LRANGE', -- command
- {ann_key .. '_ham', '0', '-1'}
+ 'SMEMBERS', -- command
+ {ann_key .. '_ham_set'}
)
end
end
nil,
false, -- is write
redis_spam_cb, --callback
- 'LRANGE', -- command
- {ann_key .. '_spam', '0', '-1'}
+ 'SMEMBERS', -- command
+ {ann_key .. '_spam_set'}
)
rspamd_logger.infox(rspamd_config, 'lock ANN %s:%s (key name %s) for learning',
nil,
false, -- is write
redis_len_cb_gen(initiate_train, 'ham', true), --callback
- 'LLEN', -- command
- {ann_key .. '_ham'}
+ 'SCARD', -- command
+ {ann_key .. '_ham_set'}
)
end
nil,
false, -- is write
redis_len_cb_gen(check_ham_len, 'spam', false), --callback
- 'LLEN', -- command
- {ann_key .. '_spam'}
+ 'SCARD', -- command
+ {ann_key .. '_spam_set'}
)
end
end