aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-07-29 16:22:46 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-07-29 16:22:46 +0100
commite9261b7c8ebcea93e0b8bbe6fc847d1168a25a4d (patch)
tree622631af5b26818f7ca72e02402280e690b39d62 /src/plugins
parentb44510d2396fe86ffde9e55fad53154ba709a329 (diff)
downloadrspamd-e9261b7c8ebcea93e0b8bbe6fc847d1168a25a4d.tar.gz
rspamd-e9261b7c8ebcea93e0b8bbe6fc847d1168a25a4d.zip
[Minor] Some more minor fixes to lua
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/lua/fann_redis.lua19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/plugins/lua/fann_redis.lua b/src/plugins/lua/fann_redis.lua
index ee73a5bf9..378000a24 100644
--- a/src/plugins/lua/fann_redis.lua
+++ b/src/plugins/lua/fann_redis.lua
@@ -423,18 +423,19 @@ local function load_or_invalidate_fann(data, id, ev_base)
end
end
-local function fann_train_callback(task, score, required_score, id, opts)
+local function fann_train_callback(task, score, required_score, id)
+ local train_opts = opts['train']
local fname,suffix = gen_fann_prefix(id)
local learn_spam, learn_ham
- if opts['spam_score'] then
- learn_spam = score >= opts['spam_score']
+ if train_opts['spam_score'] then
+ learn_spam = score >= train_opts['spam_score']
else
learn_spam = score >= required_score
end
- if opts['ham_score'] then
- learn_ham = score <= opts['ham_score']
+ if train_opts['ham_score'] then
+ learn_ham = score <= train_opts['ham_score']
else
learn_ham = score < 0
end
@@ -469,7 +470,7 @@ local function fann_train_callback(task, score, required_score, id, opts)
if err then
rspamd_logger.errx(rspamd_config, 'cannot check if we can train %s: %s', fname, err)
if string.match(err, 'NOSCRIPT') then
- load_scripts(rspamd_config, ev_base, nil)
+ load_scripts(rspamd_config, task:get_ev_base(), nil)
end
end
end
@@ -836,11 +837,9 @@ local function ann_push_vector(task)
local scores = task:get_metric_score()
local sid = task:get_settings_id()
if use_settings then
- fann_train_callback(task, scores[1], scores[2],
- tostring(sid), opts['train'])
+ fann_train_callback(task, scores[1], scores[2], tostring(sid))
else
- fann_train_callback(task, scores[1], scores[2],
- tostring(sid), opts['train'])
+ fann_train_callback(task, scores[1], scores[2], "1")
end
end