return nil
end
+---[[[
+-- @function lua_verdict.adjust_passthrough_action(task)
+-- If an action is `soft reject` then this function extracts a module that has set this action
+-- and returns an adjusted action (e.g. 'greylist' or 'ratelimit').
+-- Otherwise an action is returned as is.
+--]]
+exports.adjust_passthrough_action = function(task)
+ local action = task:get_metric_action()
+ if action == 'soft reject' then
+ local has_pr,_,_,module = task:has_pre_result()
+
+ if has_pr and module then
+ action = module
+ end
+ end
+
+ return action
+end
+
return exports
\ No newline at end of file
local fun = require "fun"
local ucl = require "ucl"
local ts = (require "tableshape").types
+local lua_verdict = require "lua_verdict"
local E = {}
local N = "history_redis"
local hostname = rspamd_util.get_hostname()
tbl.rmilter = nil
tbl.messages = nil
tbl.urls = nil
+ tbl.action = lua_verdict.adjust_passthrough_action(task)
local seconds = task:get_timeval()['tv_sec']
tbl.unix_time = seconds
rspamd_logger.errx('cannot get protocol reply, skip saving in history')
return
end
- -- 1 is 'json-compact' but faster
- local json = ucl.to_format(data, 1)
+
+ local json = ucl.to_format(data, 'json-compact')
if settings.compress then
json = rspamd_util.zstd_compress(json)