From: Vsevolod Stakhov Date: Tue, 21 Feb 2017 13:43:50 +0000 (+0000) Subject: [Minor] Save hostname when learning ANN X-Git-Tag: 1.5.0~64 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1b1c82f91d9f85f420398d6d6507808fec920fd1;p=rspamd.git [Minor] Save hostname when learning ANN --- 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