From a639c5fae0943ce758e9dc36cb57a2e81849c933 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 11 Dec 2023 14:58:25 +0000 Subject: [PATCH] [Minor] Fix learned stats --- lualib/lua_bayes_redis.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lualib/lua_bayes_redis.lua b/lualib/lua_bayes_redis.lua index e085694a9..d84d67498 100644 --- a/lualib/lua_bayes_redis.lua +++ b/lualib/lua_bayes_redis.lua @@ -111,18 +111,17 @@ exports.lua_bayes_init_statfile = function(classifier_ucl, statfile_ucl, symbol, logger.warn(cfg, 'cannot get bayes statistics for %s: %s', symbol, err) else local new_cursor = data[1] + current_data.users = current_data.users + data[2] + current_data.revision = current_data.revision + data[3] if new_cursor == 0 then -- Done iteration - final_data = current_data + final_data = lua_util.shallowcopy(current_data) current_data = { users = 0, revision = 0, } + lua_util.debugm(N, cfg, 'final data: %s', final_data) stat_periodic_cb(cfg, final_data) - else - -- Collect more data - current_data.users = current_data.users + data[2] - current_data.revision = current_data.revision + data[3] end cursor = new_cursor -- 2.39.5