]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix total learns counter for redis stats
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 28 Nov 2016 13:51:13 +0000 (13:51 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 28 Nov 2016 13:51:13 +0000 (13:51 +0000)
src/libstat/stat_process.c

index 04ebe72afd8e3425f54b186d97c5ccd90a4ffdf6..2d3a83e10be82f6f3a8c74567417a6795dc5853d 100644 (file)
@@ -1132,10 +1132,18 @@ rspamd_stat_statistics (struct rspamd_task *task,
                        st = g_ptr_array_index (st_ctx->statfiles, id);
                        backend_runtime = st->backend->runtime (task, st->stcf, FALSE,
                                        st->bkcf);
-                       learns += st->backend->total_learns (task, backend_runtime,
-                                       st->bkcf);
                        elt = st->backend->get_stat (backend_runtime, st->bkcf);
 
+                       if (elt && ucl_object_type (elt) == UCL_OBJECT) {
+                               const ucl_object_t *rev = ucl_object_lookup (elt, "revision");
+
+                               learns += ucl_object_toint (rev);
+                       }
+                       else {
+                               learns += st->backend->total_learns (task, backend_runtime,
+                                               st->bkcf);
+                       }
+
                        if (elt != NULL) {
                                ucl_array_append (res, elt);
                        }