From: Vsevolod Stakhov Date: Mon, 28 Nov 2016 13:51:13 +0000 (+0000) Subject: [Fix] Fix total learns counter for redis stats X-Git-Tag: 1.4.1~23 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0da9afe73cb379d5bb6235f2a2ef5a9d7595f386;p=rspamd.git [Fix] Fix total learns counter for redis stats --- diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c index 04ebe72af..2d3a83e10 100644 --- a/src/libstat/stat_process.c +++ b/src/libstat/stat_process.c @@ -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); }