aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-11-06 15:06:51 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-11-06 15:06:51 +0000
commit5172bac9ff82d0abc316d40b61cec13b91903a1a (patch)
tree500cb16a084c6a3060ce542e01ad60042ae61739
parent16f40922716b4d896e9dc3967fae03b32c4da4c4 (diff)
downloadrspamd-5172bac9ff82d0abc316d40b61cec13b91903a1a.tar.gz
rspamd-5172bac9ff82d0abc316d40b61cec13b91903a1a.zip
[Minor] Improve logging on neural learning errors
-rw-r--r--src/plugins/lua/neural.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/plugins/lua/neural.lua b/src/plugins/lua/neural.lua
index d96ca896a..e64751ef2 100644
--- a/src/plugins/lua/neural.lua
+++ b/src/plugins/lua/neural.lua
@@ -103,7 +103,7 @@ end
local redis_lua_script_can_store_train_vec = [[
local prefix = KEYS[1]
local locked = redis.call('HGET', prefix, 'lock')
- if locked then return 0 end
+ if locked then return {tostring(-1),'locked by another process: ' .. locked} end
local nspam = 0
local nham = 0
local lim = tonumber(KEYS[3])
@@ -474,8 +474,14 @@ local function ann_push_task_result(rule, task, verdict, score, set)
learn_type, rule.prefix, set.name, reason, -tonumber(nsamples))
end
else
- rspamd_logger.errx(task, 'cannot check if we can train %s:%s : %s',
- rule.prefix, set.name, err)
+ if err then
+ rspamd_logger.errx(task, 'cannot check if we can train %s:%s : %s',
+ rule.prefix, set.name, err)
+ else
+ rspamd_logger.errx(task, 'cannot check if we can train %s:%s : type of Redis key %s is %s, expected table' ..
+ 'please remove this key from Redis manually if you perform upgrade from the previous version',
+ rule.prefix, set.name, set.ann.redis_key, type(data))
+ end
end
end