diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-10-25 14:22:20 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-10-25 14:22:20 +0100 |
commit | e55b2d55dd4beffc4aa9a935da419b51bab3dbbe (patch) | |
tree | b1ec917a009bd31fdca5e4d4704429d75b59bd78 /lualib/lua_stat.lua | |
parent | 55fd8637509981e691f1163948b1b2c472aba2d6 (diff) | |
download | rspamd-e55b2d55dd4beffc4aa9a935da419b51bab3dbbe.tar.gz rspamd-e55b2d55dd4beffc4aa9a935da419b51bab3dbbe.zip |
[Minor] Fix configwizard behaviour when DB is empty
Diffstat (limited to 'lualib/lua_stat.lua')
-rw-r--r-- | lualib/lua_stat.lua | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lualib/lua_stat.lua b/lualib/lua_stat.lua index b5eaafcd3..ff7d192ac 100644 --- a/lualib/lua_stat.lua +++ b/lualib/lua_stat.lua @@ -101,30 +101,30 @@ return nconverted local keys = redis.call('SMEMBERS', KEYS[1]..'_keys') for _,k in ipairs(keys) do - local learns = redis.call('HGET', k, 'learns') + local learns = redis.call('HGET', k, 'learns') or 0 local neutral_prefix = string.gsub(k, KEYS[1], 'RS') redis.call('HSET', neutral_prefix, KEYS[2], learns) redis.call('SADD', KEYS[1]..'_keys', neutral_prefix) redis.call('SREM', KEYS[1]..'_keys', k) - redis.call('DEL', k) - redis.call('SET', KEYS[1]..'_version', '2') + redis.call('DEL', KEYS[1]) + redis.call('SET', k ..'_version', '2') end ]] conn:add_cmd('EVAL', {lua_script, '2', symbol_spam, 'learns_spam'}) - ret = conn:exec() + ret,res = conn:exec() if not ret then - logger.errx('error converting metadata for symbol %s', symbol_spam) + logger.errx('error converting metadata for symbol %s: %s', symbol_spam, res) return false end conn:add_cmd('EVAL', {lua_script, '2', symbol_ham, 'learns_ham'}) - ret = conn:exec() + ret, res = conn:exec() if not ret then - logger.errx('error converting metadata for symbol %s', symbol_ham) + logger.errx('error converting metadata for symbol %s', symbol_ham, res) return false end |