aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/lua_bayes_redis.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2024-01-15 15:25:23 +0000
committerVsevolod Stakhov <vsevolod@rspamd.com>2024-01-15 15:25:23 +0000
commit7b9dd286eae49337eaebdd41cfbc5d3569a1e585 (patch)
treea5a99fa21cf480a699fc53b51dfdb87b5aeb9e5e /lualib/lua_bayes_redis.lua
parent5d861d8dd15d7115bdffaf60e7b3610f080ba6be (diff)
downloadrspamd-7b9dd286eae49337eaebdd41cfbc5d3569a1e585.tar.gz
rspamd-7b9dd286eae49337eaebdd41cfbc5d3569a1e585.zip
[Minor] Fix scripts invocation
Diffstat (limited to 'lualib/lua_bayes_redis.lua')
-rw-r--r--lualib/lua_bayes_redis.lua11
1 files changed, 3 insertions, 8 deletions
diff --git a/lualib/lua_bayes_redis.lua b/lualib/lua_bayes_redis.lua
index 3321c96c3..6f6c27403 100644
--- a/lualib/lua_bayes_redis.lua
+++ b/lualib/lua_bayes_redis.lua
@@ -179,7 +179,7 @@ local function gen_cache_check_functor(redis_params, check_script_id)
if err then
callback(task, false, err)
else
- callback(task, true, data[1], data[2], data[3], data[4])
+ callback(task, true, tonumber(data))
end
end
@@ -190,20 +190,15 @@ local function gen_cache_check_functor(redis_params, check_script_id)
end
local function gen_cache_learn_functor(redis_params, learn_script_id)
- return function(task, cache_id, callback)
+ return function(task, cache_id, is_spam)
local function learn_redis_cb(err, data)
lua_util.debugm(N, task, 'learn_cache redis cb: %s, %s', err, data)
- if err then
- callback(task, false, err)
- else
- callback(task, true)
- end
end
lua_redis.exec_redis_script(learn_script_id,
{ task = task, is_write = true, key = cache_id },
learn_redis_cb,
- { cache_id })
+ { cache_id, is_spam and "1" or "0" })
end
end