]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Always report actions count
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 26 Feb 2022 13:05:01 +0000 (13:05 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 26 Feb 2022 13:32:26 +0000 (13:32 +0000)
src/controller.c

index ca9558046bd239f52b28894244bcf9f5eb8f3b6c..3b4fa3f469f8feef09509e4a67642f938e331a61 100644 (file)
@@ -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);