aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-02-21 13:43:50 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-02-21 13:43:50 +0000
commit1b1c82f91d9f85f420398d6d6507808fec920fd1 (patch)
treee0d3f06435e5e71b64541c3665b05ea7290f0a2d
parentff25c4560ed78e6f6bc84ae34532ae9bad80c558 (diff)
downloadrspamd-1b1c82f91d9f85f420398d6d6507808fec920fd1.tar.gz
rspamd-1b1c82f91d9f85f420398d6d6507808fec920fd1.zip
[Minor] Save hostname when learning ANN
-rw-r--r--src/plugins/lua/fann_redis.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/lua/fann_redis.lua b/src/plugins/lua/fann_redis.lua
index 76ab54062..a9c6a41cb 100644
--- a/src/plugins/lua/fann_redis.lua
+++ b/src/plugins/lua/fann_redis.lua
@@ -118,6 +118,7 @@ local redis_locked_invalidate_sha = nil
-- key1 - prefix for keys
-- key2 - current time
-- key3 - key expire
+-- key4 - hostname
local redis_lua_script_maybe_lock = [[
local locked = redis.call('GET', KEYS[1] .. '_locked')
if locked then
@@ -126,6 +127,7 @@ local redis_lua_script_maybe_lock = [[
end
end
redis.call('SET', KEYS[1] .. '_locked', tostring(tonumber(KEYS[2]) + tonumber(KEYS[3])))
+ redis.call('SET', KEYS[1] .. '_hostname', KEYS[4])
return 1
]]
local redis_maybe_lock_sha = nil
@@ -755,8 +757,8 @@ local function train_fann(_, ev_base, elt)
true, -- is write
redis_lock_cb, --callback
'EVALSHA', -- command
- {redis_maybe_lock_sha, '3', gen_fann_prefix(elt), tostring(os.time()),
- tostring(lock_expire)}
+ {redis_maybe_lock_sha, '4', gen_fann_prefix(elt), tostring(os.time()),
+ tostring(lock_expire), rspamd_util.get_hostname()}
)
end