diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-09-25 15:07:04 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-09-25 15:07:04 +0100 |
commit | 3acd96b8391d6a60a10a1da25fc652be34e13809 (patch) | |
tree | 303661ea153c640d2d12d73055d4fc2abc3106ac /src/libserver | |
parent | 4bf41bd8729aac7c1aa48057d1afed3686d323cd (diff) | |
download | rspamd-3acd96b8391d6a60a10a1da25fc652be34e13809.tar.gz rspamd-3acd96b8391d6a60a10a1da25fc652be34e13809.zip |
Add no_stat flag.
Issue: #382
Diffstat (limited to 'src/libserver')
-rw-r--r-- | src/libserver/protocol.c | 23 | ||||
-rw-r--r-- | 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)) |