From: Vsevolod Stakhov Date: Wed, 21 Feb 2018 15:45:12 +0000 (+0000) Subject: [Fix] Fix various issues in stat_convert X-Git-Tag: 1.7.0~153 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=395c1e6847a3a7162c7415175700076355f8ecd0;p=thirdparty%2Frspamd.git [Fix] Fix various issues in stat_convert --- diff --git a/lualib/lua_redis.lua b/lualib/lua_redis.lua index c01cdfae99..2102db841a 100644 --- a/lualib/lua_redis.lua +++ b/lualib/lua_redis.lua @@ -914,6 +914,8 @@ local function redis_connect_sync(redis_params, is_write, key, cfg) if not ret then logger.errx('cannot execute redis request: %s', conn) addr:fail() + + return false,nil,addr end if conn then diff --git a/lualib/rspamadm/stat_convert.lua b/lualib/rspamadm/stat_convert.lua index 31c37880ad..f70581fa42 100644 --- a/lualib/rspamadm/stat_convert.lua +++ b/lualib/rspamadm/stat_convert.lua @@ -1,4 +1,4 @@ -local lua_redis = require "rspamd_redis" +local lua_redis = require "lua_redis" local stat_tools = require "stat_tools" local ucl = require "ucl" local logger = require "rspamd_logger" diff --git a/lualib/stat_tools.lua b/lualib/stat_tools.lua index f969f10007..f952ec9a9b 100644 --- a/lualib/stat_tools.lua +++ b/lualib/stat_tools.lua @@ -223,7 +223,7 @@ end if is_spam then hash_key = 'S' end - for _,tok in tokens do + for _,tok in ipairs(tokens) do -- tok schema: -- tok[1] = token_id (uint64 represented as a string) -- tok[2] = token value (number) @@ -356,8 +356,9 @@ end end end - logger.messagex('Migrated %d tokens for %d users for symbol %s', - total, nusers, res['symbol']) + logger.messagex('Migrated %s tokens for %s users for symbols (%s, %s)', + total, nusers, symbol_spam, symbol_ham) + return true end exports.convert_sqlite_to_redis = convert_sqlite_to_redis