aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-05-19 15:06:48 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-05-19 15:07:04 +0100
commit6a9f1eab80a7205f545680fb5fd2be763c0c32a5 (patch)
tree897d45f67a19aa4b6d4c68cf5611eb8ded8bcd38
parent3c1cad1ced8e8d98a1aa75fe9c3f07ee98ab4215 (diff)
downloadrspamd-6a9f1eab80a7205f545680fb5fd2be763c0c32a5.tar.gz
rspamd-6a9f1eab80a7205f545680fb5fd2be763c0c32a5.zip
[Minor] Fix redis_params usage
-rw-r--r--lualib/global_functions.lua2
-rw-r--r--src/plugins/lua/dmarc.lua5
-rw-r--r--src/plugins/lua/fann_redis.lua23
3 files changed, 29 insertions, 1 deletions
diff --git a/lualib/global_functions.lua b/lualib/global_functions.lua
index 29b8f7328..d0cab3acd 100644
--- a/lualib/global_functions.lua
+++ b/lualib/global_functions.lua
@@ -186,7 +186,7 @@ end
exports.rspamd_redis_make_request = rspamd_redis_make_request
exports.redis_make_request = rspamd_redis_make_request
-local function redis_make_request_taskless(ev_base, cfg, key, is_write, callback, command, args)
+local function redis_make_request_taskless(ev_base, cfg, redis_params, key, is_write, callback, command, args)
if not ev_base or not redis_params or not callback or not command then
return false,nil,nil
end
diff --git a/src/plugins/lua/dmarc.lua b/src/plugins/lua/dmarc.lua
index 0aba39462..93775249b 100644
--- a/src/plugins/lua/dmarc.lua
+++ b/src/plugins/lua/dmarc.lua
@@ -164,6 +164,7 @@ local function load_scripts(cfg, ev_base)
end
local ret = globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
true, -- is write
redis_report_script_cb, --callback
@@ -875,6 +876,7 @@ if opts['reporting'] == true then
if cursor ~= 0 then
local ret = globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
false, -- is write
dmarc_push_cb, --callback
@@ -892,6 +894,7 @@ if opts['reporting'] == true then
end
local ret = globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
false, -- is write
dmarc_push_cb, --callback
@@ -914,6 +917,7 @@ if opts['reporting'] == true then
end
local ret = globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
false, -- is write
delete_reports_cb, --callback
@@ -1080,6 +1084,7 @@ if opts['reporting'] == true then
local idx_key = table.concat({redis_keys.index_prefix, want_period}, redis_keys.join_char)
local ret = globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
false, -- is write
get_reporting_domain_cb, --callback
diff --git a/src/plugins/lua/fann_redis.lua b/src/plugins/lua/fann_redis.lua
index 76da1175b..78d945466 100644
--- a/src/plugins/lua/fann_redis.lua
+++ b/src/plugins/lua/fann_redis.lua
@@ -185,6 +185,7 @@ local function load_scripts(cfg, ev_base, on_load_cb)
end
globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
true, -- is write
can_train_sha_cb, --callback
@@ -208,6 +209,7 @@ local function load_scripts(cfg, ev_base, on_load_cb)
end
globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
true, -- is write
maybe_load_sha_cb, --callback
@@ -224,6 +226,7 @@ local function load_scripts(cfg, ev_base, on_load_cb)
end
globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
true, -- is write
maybe_invalidate_sha_cb, --callback
@@ -240,6 +243,7 @@ local function load_scripts(cfg, ev_base, on_load_cb)
end
globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
true, -- is write
locked_invalidate_sha_cb, --callback
@@ -256,6 +260,7 @@ local function load_scripts(cfg, ev_base, on_load_cb)
end
globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
true, -- is write
maybe_lock_sha_cb, --callback
@@ -272,6 +277,7 @@ local function load_scripts(cfg, ev_base, on_load_cb)
end
globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
true, -- is write
save_unlock_sha_cb, --callback
@@ -429,6 +435,7 @@ local function load_or_invalidate_fann(data, id, ev_base)
rspamd_logger.infox(rspamd_config, 'invalidate ANN %s', prefix)
globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
true, -- is write
redis_invalidate_cb, --callback
@@ -476,6 +483,7 @@ local function fann_train_callback(score, required_score, results, _, id, opts,
globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
true, -- is write
learn_vec_cb, --callback
@@ -494,6 +502,7 @@ local function fann_train_callback(score, required_score, results, _, id, opts,
globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
true, -- is write
can_train_cb, --callback
@@ -522,6 +531,7 @@ local function train_fann(_, ev_base, elt)
prefix, err)
globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
false, -- is write
redis_unlock_cb, --callback
@@ -541,6 +551,7 @@ local function train_fann(_, ev_base, elt)
prefix, errmsg)
globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
true, -- is write
redis_unlock_cb, --callback
@@ -556,6 +567,7 @@ local function train_fann(_, ev_base, elt)
fanns[elt].fann_train = nil
globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
true, -- is write
redis_save_cb, --callback
@@ -571,6 +583,7 @@ local function train_fann(_, ev_base, elt)
prefix, err)
globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
true, -- is write
redis_unlock_cb, --callback
@@ -621,6 +634,7 @@ local function train_fann(_, ev_base, elt)
rspamd_logger.infox(rspamd_config, 'invalidate ANN %s: training data is invalid', prefix)
globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
true, -- is write
redis_invalidate_cb, --callback
@@ -642,6 +656,7 @@ local function train_fann(_, ev_base, elt)
prefix, err)
globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
true, -- is write
redis_unlock_cb, --callback
@@ -656,6 +671,7 @@ local function train_fann(_, ev_base, elt)
end, data))
globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
false, -- is write
redis_ham_cb, --callback
@@ -676,6 +692,7 @@ local function train_fann(_, ev_base, elt)
-- Can train ANN
globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
false, -- is write
redis_spam_cb, --callback
@@ -697,6 +714,7 @@ local function train_fann(_, ev_base, elt)
if learning_spawned then
globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
true, -- is write
redis_lock_extend_cb, --callback
@@ -721,6 +739,7 @@ local function train_fann(_, ev_base, elt)
end
globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
true, -- is write
redis_lock_cb, --callback
@@ -752,6 +771,7 @@ local function maybe_train_fanns(cfg, ev_base)
globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
false, -- is write
redis_len_cb, --callback
@@ -770,6 +790,7 @@ local function maybe_train_fanns(cfg, ev_base)
-- First we need to get all fanns stored in our Redis
globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
false, -- is write
members_cb, --callback
@@ -806,6 +827,7 @@ local function check_fanns(_, ev_base)
end
globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
false, -- is write
redis_update_cb, --callback
@@ -824,6 +846,7 @@ local function check_fanns(_, ev_base)
-- First we need to get all fanns stored in our Redis
globals.redis_make_request_taskless(ev_base,
rspamd_config,
+ redis_params,
nil,
false, -- is write
members_cb, --callback