diff --git a/src/redis-cli.c b/src/redis-cli.c index 1b4494c95..6d077dbdd 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -2524,7 +2524,10 @@ cleanup: static int clusterManagerNodeConnect(clusterManagerNode *node) { if (node->context) redisFree(node->context); - node->context = redisConnect(node->ip, node->port); + struct timeval tv; + tv.tv_sec = config.cluster_manager_command.timeout / 1000; + tv.tv_usec = (config.cluster_manager_command.timeout % 1000) * 1000; + node->context = redisConnectWithTimeout(node->ip, node->port, tv); if (!node->context->err && config.tls) { const char *err = NULL; if (cliSecureConnection(node->context, config.sslconfig, &err) == REDIS_ERR && err) { @@ -5626,7 +5629,10 @@ static int clusterManagerCommandImport(int argc, char **argv) { char *reply_err = NULL; redisReply *src_reply = NULL; // Connect to the source node. - redisContext *src_ctx = redisConnect(src_ip, src_port); + struct timeval tv; + tv.tv_sec = config.cluster_manager_command.timeout / 1000; + tv.tv_usec = (config.cluster_manager_command.timeout % 1000) * 1000; + redisContext *src_ctx = redisConnectWithTimeout(src_ip, src_port, tv); if (src_ctx->err) { success = 0; fprintf(stderr,"Could not connect to KeyDB at %s:%d: %s.\n", src_ip,