From 1b1c82f91d9f85f420398d6d6507808fec920fd1 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 21 Feb 2017 13:43:50 +0000 Subject: [PATCH] [Minor] Save hostname when learning ANN --- src/plugins/lua/fann_redis.lua | 6 ++++-- 1 file 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 -- 2.39.5