Module: kamailio
Branch: 5.7
Commit: a7e9a26542010e1677fcb0e305e7d371e5467dba
URL:
https://github.com/kamailio/kamailio/commit/a7e9a26542010e1677fcb0e305e7d37…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-03-20T13:27:15+01:00
ndb_redis: break on finding a server via sentinel inside redisc_reconnect_server()
(cherry picked from commit 951ab118bb7d9955f8e69b66bec1f0c107d474a2)
(cherry picked from commit 60fd6c2622c9c5edbe82908c0e461d646225c8a6)
---
Modified: src/modules/ndb_redis/redis_client.c
---
Diff:
https://github.com/kamailio/kamailio/commit/a7e9a26542010e1677fcb0e305e7d37…
Patch:
https://github.com/kamailio/kamailio/commit/a7e9a26542010e1677fcb0e305e7d37…
---
diff --git a/src/modules/ndb_redis/redis_client.c b/src/modules/ndb_redis/redis_client.c
index e85fdcec7aa..eed2e1bcc88 100644
--- a/src/modules/ndb_redis/redis_client.c
+++ b/src/modules/ndb_redis/redis_client.c
@@ -485,6 +485,7 @@ int redisc_reconnect_server(redisc_server_t *rsrv)
for(i = 0; i < sentinels_count; i++) {
char *sentinelAddr = sentinels[i];
char *pos;
+ int srvfound = 0;
redisContext *redis;
redisReply *res, *res2;
@@ -507,6 +508,7 @@ int redisc_reconnect_server(redisc_server_t *rsrv)
port = atoi(res->element[1]->str);
LOG(ndb_redis_debug, "sentinel replied: %s:%d\n", addr,
port);
+ srvfound = 1;
}
} else {
res = redisCommand(
@@ -530,9 +532,13 @@ int redisc_reconnect_server(redisc_server_t *rsrv)
}
LOG(ndb_redis_debug, "slave for %s: %s:%d\n",
sentinel_group, addr, port);
+ srvfound = 1;
}
}
}
+ if(srvfound == 1) {
+ break;
+ }
}
}