From a84c4921308bc4fd2163c8d0dae487a2a05b4b33 Mon Sep 17 00:00:00 2001 From: Badlop Date: Thu, 5 Dec 2024 10:13:51 +0100 Subject: [PATCH] Redis: Use the recommended eredis:start_link/1 function --- src/ejabberd_redis.erl | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/ejabberd_redis.erl b/src/ejabberd_redis.erl index 45a689549..0c4a5c9aa 100644 --- a/src/ejabberd_redis.erl +++ b/src/ejabberd_redis.erl @@ -483,14 +483,26 @@ connect(#state{num = Num}) -> do_connect(1, Server, Port, Pass, _DB, _ConnTimeout) -> %% First connection in the pool is always a subscriber - Res = eredis_sub:start_link(Server, Port, Pass, no_reconnect, infinity, drop), + Options = [{host, Server}, + {port, Port}, + {password, Pass}, + {reconnect_sleep, no_reconnect}, + {max_queue_size, infinity}, + {queue_behaviour, drop}], + Res = eredis_sub:start_link(Options), case Res of {ok, Pid} -> eredis_sub:controlling_process(Pid); _ -> ok end, Res; do_connect(_, Server, Port, Pass, DB, ConnTimeout) -> - eredis:start_link(Server, Port, DB, Pass, no_reconnect, ConnTimeout). + Options = [{host, Server}, + {port, Port}, + {database, DB}, + {password, Pass}, + {reconnect_sleep, no_reconnect}, + {connect_timeout, ConnTimeout}], + eredis:start_link(Options). -spec call(pos_integer(), {q, redis_command()}, integer()) -> {ok, redis_reply()} | redis_error();