From f35c7fe0016fea44bbfa4d686f985cf5db4a3372 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Mon, 28 Feb 2022 15:24:21 +0100 Subject: [PATCH] db_redis: clean previous connection before trying to reconnect (cherry picked from commit 78c8d084e30373aacc456fd41062b68e6e82ea6f) (cherry picked from commit 2e0537ba306219df0ce71605848e811027c69a57) (cherry picked from commit 78506f7f2dfcdbf2bc9e21168929437516a368bd) --- src/modules/db_redis/redis_connection.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/db_redis/redis_connection.c b/src/modules/db_redis/redis_connection.c index 5a5887d6588..bb7423fcbdc 100644 --- a/src/modules/db_redis/redis_connection.c +++ b/src/modules/db_redis/redis_connection.c @@ -111,6 +111,11 @@ int db_redis_connect(km_redis_con_t *con) { db = atoi(con->id->database); reply = NULL; + if(con->con) { + LM_DBG("free old connection first\n"); + redisFree(con->con); + } + // TODO: introduce require_master mod-param and check if we're indeed master // TODO: on carrier, if we have db fail-over, the currently connected // redis server will become slave without dropping connections?