diff options
author | Mikhail Galanin <mgalanin@mimecast.com> | 2018-10-01 10:41:51 +0100 |
---|---|---|
committer | Mikhail Galanin <mgalanin@mimecast.com> | 2018-10-01 10:41:51 +0100 |
commit | 4dfe49bc169346ae120bafbda643f0477886da41 (patch) | |
tree | 0094428fae6189ab1a6b5b38333634dc02402038 /lualib/lua_redis.lua | |
parent | 5c8208c6972fb0e5880836b7957cf7dd63ac0897 (diff) | |
download | rspamd-4dfe49bc169346ae120bafbda643f0477886da41.tar.gz rspamd-4dfe49bc169346ae120bafbda643f0477886da41.zip |
[Minor] Fixed sync redis connection with default arguments in rspamadm
Diffstat (limited to 'lualib/lua_redis.lua')
-rw-r--r-- | lualib/lua_redis.lua | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/lualib/lua_redis.lua b/lualib/lua_redis.lua index 92ff4cc12..e95981c82 100644 --- a/lualib/lua_redis.lua +++ b/lualib/lua_redis.lua @@ -997,12 +997,6 @@ local function redis_connect_sync(redis_params, is_write, key, cfg, ev_base) if not redis_params then return false,nil end - if not cfg then - cfg = rspamd_config - end - if not ev_base then - ev_base = rspamadm_ev_base - end local rspamd_redis = require "rspamd_redis" local addr @@ -1028,14 +1022,30 @@ local function redis_connect_sync(redis_params, is_write, key, cfg, ev_base) local options = { host = addr:get_addr(), timeout = redis_params['timeout'], - config = cfg, - ev_base = ev_base + config = cfg or rspamd_config, + ev_base = ev_base or rspamadm_ev_base, + session = redis_params.session or rspamadm_session } for k,v in pairs(redis_params) do options[k] = v end + if not options.config then + logger.errx('config is not set') + return false,nil,addr + end + + if not options.ev_base then + logger.errx('ev_base is not set') + return false,nil,addr + end + + if not options.session then + logger.errx('session is not set') + return false,nil,addr + end + local ret,conn = rspamd_redis.connect_sync(options) if not ret then logger.errx('cannot execute redis request: %s', conn) |