Skip to content

Commit

Permalink
ndb_redis: break on finding a server via sentinel inside redisc_recon…
Browse files Browse the repository at this point in the history
…nect_server()
  • Loading branch information
miconda committed Mar 19, 2024
1 parent c8f3b49 commit 951ab11
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/modules/ndb_redis/redis_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,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;

Expand All @@ -555,6 +556,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(
Expand All @@ -578,9 +580,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;
}
}
}

Expand Down

0 comments on commit 951ab11

Please sign in to comment.