From 3acd96b8391d6a60a10a1da25fc652be34e13809 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 25 Sep 2015 15:07:04 +0100 Subject: [PATCH] Add no_stat flag. Issue: #382 --- src/libserver/protocol.c | 23 +++++++++++++---------- src/libserver/task.h | 1 + 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c index 8cf6b771f..360239f34 100644 --- a/src/libserver/protocol.c +++ b/src/libserver/protocol.c @@ -1154,18 +1154,21 @@ rspamd_protocol_http_reply (struct rspamd_http_message *msg, } ucl_object_unref (top); - /* Update stat for default metric */ - metric_res = g_hash_table_lookup (task->results, DEFAULT_METRIC); - if (metric_res != NULL) { - action = rspamd_check_action_metric (task, metric_res->score, &required_score, - metric_res->metric); - if (action <= METRIC_ACTION_NOACTION) { - task->worker->srv->stat->actions_stat[action]++; + if (!(task->flags & RSPAMD_TASK_FLAG_NO_STAT)) { + /* Update stat for default metric */ + metric_res = g_hash_table_lookup (task->results, DEFAULT_METRIC); + if (metric_res != NULL) { + action = rspamd_check_action_metric (task, metric_res->score, &required_score, + metric_res->metric); + if (action <= METRIC_ACTION_NOACTION) { + task->worker->srv->stat->actions_stat[action]++; + } } - } - /* Increase counters */ - task->worker->srv->stat->messages_scanned++; + /* Increase counters */ + + task->worker->srv->stat->messages_scanned++; + } } void diff --git a/src/libserver/task.h b/src/libserver/task.h index 01d3aff42..16c3d4a70 100644 --- a/src/libserver/task.h +++ b/src/libserver/task.h @@ -91,6 +91,7 @@ enum rspamd_task_stage { #define RSPAMD_TASK_FLAG_PROCESSING (1 << 10) #define RSPAMD_TASK_FLAG_GTUBE (1 << 11) #define RSPAMD_TASK_FLAG_FILE (1 << 12) +#define RSPAMD_TASK_FLAG_NO_STAT (1 << 13) #define RSPAMD_TASK_IS_SKIPPED(task) (((task)->flags & RSPAMD_TASK_FLAG_SKIP)) #define RSPAMD_TASK_IS_JSON(task) (((task)->flags & RSPAMD_TASK_FLAG_JSON)) -- 2.39.5