From 87e7d95c090b565597e762f54a5deedbd6d298fd Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 18 Jun 2021 10:47:11 +0200 Subject: [PATCH] Fix asynchronous resource cleanup on failed connect #1768 --- src/main/java/io/lettuce/core/RedisClient.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/lettuce/core/RedisClient.java b/src/main/java/io/lettuce/core/RedisClient.java index 4d477f2b68..8554b76274 100644 --- a/src/main/java/io/lettuce/core/RedisClient.java +++ b/src/main/java/io/lettuce/core/RedisClient.java @@ -290,7 +290,7 @@ private ConnectionFuture> connectStandalone future.whenComplete((channelHandler, throwable) -> { if (throwable != null) { - connection.close(); + connection.closeAsync(); } }); @@ -602,8 +602,8 @@ private ConnectionFuture> doConnect return sync.thenApply(ignore -> (StatefulRedisSentinelConnection) connection).whenComplete((ignore, e) -> { if (e != null) { - logger.warn("Cannot connect Redis Sentinel at " + redisURI + ": " + e.toString()); - connection.close(); + logger.warn("Cannot connect Redis Sentinel at " + redisURI + ": " + e); + connection.closeAsync(); } }); }