diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-12-08 13:32:18 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-12-08 13:32:18 +0000 |
commit | d3d19ad641185f0fdb380705cb999e51dbbb5e50 (patch) | |
tree | b5d09483f57c8565777c358196277f7321aa13ea /src/worker.c | |
parent | b6d78afab84d30a8a5d1a014f254355df7710ccb (diff) | |
download | rspamd-d3d19ad641185f0fdb380705cb999e51dbbb5e50.tar.gz rspamd-d3d19ad641185f0fdb380705cb999e51dbbb5e50.zip |
[Feature] Core: allow to emit soft reject on task timeout
Diffstat (limited to 'src/worker.c')
-rw-r--r-- | src/worker.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/worker.c b/src/worker.c index 81c59a786..5147e0a2d 100644 --- a/src/worker.c +++ b/src/worker.c @@ -142,6 +142,26 @@ rspamd_task_timeout (gint fd, short what, gpointer ud) if (!(task->processed_stages & RSPAMD_TASK_STAGE_FILTERS)) { msg_info_task ("processing of task timed out, forced processing"); + + if (task->cfg->soft_reject_on_timeout) { + struct rspamd_metric_result *res = task->result; + + if (rspamd_check_action_metric (task, res) != METRIC_ACTION_REJECT) { + rspamd_add_passthrough_result (task, + METRIC_ACTION_SOFT_REJECT, + 0, + NAN, + "timeout processing message", + "task timeout"); + + ucl_object_replace_key (task->messages, + ucl_object_fromstring_common ("timeout processing message", + 0, UCL_STRING_RAW), + "smtp_message", 0, + false); + } + } + task->processed_stages |= RSPAMD_TASK_STAGE_FILTERS; rspamd_session_cleanup (task->s); rspamd_task_process (task, RSPAMD_TASK_PROCESS_ALL); |