diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2022-02-26 13:05:01 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2022-02-26 13:32:26 +0000 |
commit | 9c5ecc6e60ab4d582450337eedf2d9c066209cc1 (patch) | |
tree | c2c49fd4cc2e3ee42df2a183211ed63635ccfcb3 | |
parent | d642742956728f4cd11d35f7d64bc61ba972dab3 (diff) | |
download | rspamd-9c5ecc6e60ab4d582450337eedf2d9c066209cc1.tar.gz rspamd-9c5ecc6e60ab4d582450337eedf2d9c066209cc1.zip |
[Minor] Always report actions count
-rw-r--r-- | src/controller.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/controller.c b/src/controller.c index ca9558046..3b4fa3f46 100644 --- a/src/controller.c +++ b/src/controller.c @@ -2681,29 +2681,27 @@ rspamd_controller_handle_stat_common ( ucl_object_insert_key (top, ucl_object_fromint ( stat->messages_learned), "learned", 0, false); - if (stat->messages_scanned > 0) { - sub = ucl_object_typed_new (UCL_OBJECT); - for (i = METRIC_ACTION_REJECT; i <= METRIC_ACTION_NOACTION; i++) { - ucl_object_insert_key (sub, + sub = ucl_object_typed_new (UCL_OBJECT); + for (i = METRIC_ACTION_REJECT; i <= METRIC_ACTION_NOACTION; i++) { + ucl_object_insert_key (sub, ucl_object_fromint (stat->actions_stat[i]), rspamd_action_to_str (i), 0, false); - if (i < METRIC_ACTION_GREYLIST) { - spam += stat->actions_stat[i]; - } - else { - ham += stat->actions_stat[i]; - } - if (do_reset) { + if (i < METRIC_ACTION_GREYLIST) { + spam += stat->actions_stat[i]; + } + else { + ham += stat->actions_stat[i]; + } + if (do_reset) { #ifndef HAVE_ATOMIC_BUILTINS - session->ctx->worker->srv->stat->actions_stat[i] = 0; + session->ctx->worker->srv->stat->actions_stat[i] = 0; #else - __atomic_store_n(&session->ctx->worker->srv->stat->actions_stat[i], - 0, __ATOMIC_RELEASE); + __atomic_store_n(&session->ctx->worker->srv->stat->actions_stat[i], + 0, __ATOMIC_RELEASE); #endif - } } - ucl_object_insert_key (top, sub, "actions", 0, false); } + ucl_object_insert_key (top, sub, "actions", 0, false); ucl_object_insert_key (top, ucl_object_fromint ( spam), "spam_count", 0, false); |