aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-12-11 14:58:25 +0000
committerVsevolod Stakhov <vsevolod@rspamd.com>2023-12-11 14:58:25 +0000
commita639c5fae0943ce758e9dc36cb57a2e81849c933 (patch)
tree22bd16e3a9c1e346cb9a282f191a567a7af48f22
parent6b39c0f971fa101cf56250792b4892a0c665ba2b (diff)
downloadrspamd-a639c5fae0943ce758e9dc36cb57a2e81849c933.tar.gz
rspamd-a639c5fae0943ce758e9dc36cb57a2e81849c933.zip
[Minor] Fix learned stats
-rw-r--r--lualib/lua_bayes_redis.lua9
1 files 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