return str
end
+---[[[
+-- @function lua_util.shuffle(table)
+-- Performs in-place shuffling of a table
+-- @param {table} tbl table to shuffle
+-- @return {table} same table
+--]]]
+exports.shuffle = function(tbl)
+ local size = #tbl
+ for i = size, 1, -1 do
+ local rand = math.random(size)
+ tbl[i], tbl[rand] = tbl[rand], tbl[i]
+ end
+ return tbl
+end
+
return exports
return table.concat({...}, dmarc_settings.reporting.redis_keys.join_char)
end
--- Helper to shuffle a Lua table
-local function shuffle(tbl)
- local size = #tbl
- for i = size, 1, -1 do
- local rand = math.random(size)
- tbl[i], tbl[rand] = tbl[rand], tbl[i]
- end
- return tbl
-end
+
local function get_rua(rep_key)
local parts = lua_util.str_split(rep_key, dmarc_settings.reporting.redis_keys.join_char)
end
-- Shuffle reports to make sending more fair
- shuffle(reports)
+ lua_util.shuffle(reports)
-- Remove processed key
if not opts.no_opt then
lua_redis.request(redis_params, redis_attrs,
mxes[name].checked = true
else
-- Try to open TCP connection to port 25
+
for _,res in ipairs(results) do
local t_ret = rspamd_tcp.new({
task = task,