local rspamd_tcp = require "rspamd_tcp"
local rspamd_url = require "rspamd_url"
local rspamd_util = require "rspamd_util"
-local globals = require "global_functions"
+local rspamd_redis = require "lua_redis"
local check_local = false
local check_authed = false
rspamd_logger.infox(cfg, 'Loaded DMARC report script with SHA %s', take_report_sha)
end
end
- local ret = globals.redis_make_request_taskless(ev_base,
+ local ret = rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
local idx_key = table.concat({redis_keys.index_prefix, period}, redis_keys.join_char)
if report_data then
- local ret = globals.redis_make_request(task,
+ local ret = rspamd_redis.redis_make_request(task,
redis_params, -- connect params
hfromdom, -- hash key
true, -- is write
dmarc_xml('push', {data[2][i], data[2][i+1]})
end
if cursor ~= 0 then
- local ret = globals.redis_make_request_taskless(ev_base,
+ local ret = rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
end
end
end
- local ret = globals.redis_make_request_taskless(ev_base,
+ local ret = rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
rspamd_logger.infox(rspamd_config, 'Deleted reports for %s', reporting_domain)
get_reporting_domain()
end
- local ret = globals.redis_make_request_taskless(ev_base,
+ local ret = rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
end
end
local idx_key = table.concat({redis_keys.index_prefix, want_period}, redis_keys.join_char)
- local ret = globals.redis_make_request_taskless(ev_base,
+ local ret = rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
local rspamd_util = require "rspamd_util"
local fann_symbol_spam = 'FANNR_SPAM'
local fann_symbol_ham = 'FANNR_HAM'
-local globals = require "global_functions"
+local rspamd_redis = require "lua_redis"
local fun = require "fun"
local module_log_id = 0x200
redis_can_train_sha = tostring(data)
end
end
- globals.redis_make_request_taskless(ev_base,
+ rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
end
end
end
- globals.redis_make_request_taskless(ev_base,
+ rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
redis_maybe_invalidate_sha = tostring(data)
end
end
- globals.redis_make_request_taskless(ev_base,
+ rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
redis_locked_invalidate_sha = tostring(data)
end
end
- globals.redis_make_request_taskless(ev_base,
+ rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
redis_maybe_lock_sha = tostring(data)
end
end
- globals.redis_make_request_taskless(ev_base,
+ rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
redis_save_unlock_sha = tostring(data)
end
end
- globals.redis_make_request_taskless(ev_base,
+ rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
end
-- Invalidate ANN
rspamd_logger.infox(rspamd_config, 'invalidate ANN %s', prefix)
- globals.redis_make_request_taskless(ev_base,
+ rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
fun.each(function(e) table.insert(learn_data, e) end, extra)
local str = rspamd_util.zstd_compress(table.concat(learn_data, ';'))
- globals.redis_make_request_taskless(ev_base,
+ rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
end
end
- globals.redis_make_request_taskless(ev_base,
+ rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
if err then
rspamd_logger.errx(rspamd_config, 'cannot save ANN %s to redis: %s',
prefix, err)
- globals.redis_make_request_taskless(ev_base,
+ rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
if errcode ~= 0 then
rspamd_logger.errx(rspamd_config, 'cannot train ANN %s: %s',
prefix, errmsg)
- globals.redis_make_request_taskless(ev_base,
+ rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
fanns[elt].version = fanns[elt].version + 1
fanns[elt].fann = fanns[elt].fann_train
fanns[elt].fann_train = nil
- globals.redis_make_request_taskless(ev_base,
+ rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
if err or type(data) ~= 'table' then
rspamd_logger.errx(rspamd_config, 'cannot get ham tokens for ANN %s from redis: %s',
prefix, err)
- globals.redis_make_request_taskless(ev_base,
+ rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
end
-- Invalidate ANN
rspamd_logger.infox(rspamd_config, 'invalidate ANN %s: training data is invalid', prefix)
- globals.redis_make_request_taskless(ev_base,
+ rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
if err or type(data) ~= 'table' then
rspamd_logger.errx(rspamd_config, 'cannot get spam tokens for ANN %s from redis: %s',
prefix, err)
- globals.redis_make_request_taskless(ev_base,
+ rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
local _,str = rspamd_util.zstd_decompress(tok)
return fun.totable(fun.map(tonumber, rspamd_str_split(tostring(str), ';')))
end, data))
- globals.redis_make_request_taskless(ev_base,
+ rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
end
elseif type(data) == 'number' then
-- Can train ANN
- globals.redis_make_request_taskless(ev_base,
+ rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
end
end
if learning_spawned then
- globals.redis_make_request_taskless(ev_base,
+ rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
rspamd_logger.infox(rspamd_config, 'do not learn ANN %s, already learning another ANN', prefix)
return
end
- globals.redis_make_request_taskless(ev_base,
+ rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
end
end
- globals.redis_make_request_taskless(ev_base,
+ rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
return 1.0
end
-- First we need to get all fanns stored in our Redis
- globals.redis_make_request_taskless(ev_base,
+ rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
local_ver = fanns[elt].version
end
end
- globals.redis_make_request_taskless(ev_base,
+ rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,
return 1.0
end
-- First we need to get all fanns stored in our Redis
- globals.redis_make_request_taskless(ev_base,
+ rspamd_redis.redis_make_request_taskless(ev_base,
rspamd_config,
redis_params,
nil,