From: Vsevolod Stakhov Date: Fri, 25 Sep 2015 14:07:04 +0000 (+0100) Subject: Add no_stat flag. X-Git-Tag: 1.0.3~17 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3acd96b8391d6a60a10a1da25fc652be34e13809;p=thirdparty%2Frspamd.git Add no_stat flag. Issue: #382 --- diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c index 8cf6b771f8..360239f34a 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 01d3aff423..16c3d4a70b 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))