commit 26254f7: [Minor] Fix hostname usage

Vsevolod Stakhov vsevolod at highsecure.ru
Sat Aug 29 09:49:06 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-08-29 10:45:34 +0100
URL: https://github.com/rspamd/rspamd/commit/26254f787bf010cc8ca198cecee83c30ef0dc844 (HEAD -> master)

[Minor] Fix hostname usage

---
 src/plugins/lua/neural.lua | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/plugins/lua/neural.lua b/src/plugins/lua/neural.lua
index d7410b225..5a19bd043 100644
--- a/src/plugins/lua/neural.lua
+++ b/src/plugins/lua/neural.lua
@@ -115,7 +115,7 @@ local redis_lua_script_vectors_len = [[
   local prefix = KEYS[1]
   local locked = redis.call('HGET', prefix, 'lock')
   if locked then
-    local host = redis.call('HGET', prefix, 'hostname')
+    local host = redis.call('HGET', prefix, 'hostname') or 'unknown'
     return string.format('%s:%s', hostname, locked)
   end
   local nspam = 0
@@ -167,7 +167,7 @@ local redis_lua_script_maybe_lock = [[
     locked = tonumber(locked)
     local expire = tonumber(KEYS[3])
     if now > locked and (now - locked) < expire then
-      return {tostring(locked), redis.call('HGET', KEYS[1], 'hostname')}
+      return {tostring(locked), redis.call('HGET', KEYS[1], 'hostname') or 'unknown'}
     end
   end
   redis.call('HSET', KEYS[1], 'lock', tostring(now))


More information about the Commits mailing list