Skip to content

Commit 153841e

Browse files
committed
Revert Sharded Jedis related changes from "Avoid using QUIT command (#3377)"
This partially reverts commit 1787d31.
1 parent 1787d31 commit 153841e

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/main/java/redis/clients/jedis/BinaryShardedJedis.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,20 @@ public BinaryShardedJedis(List<JedisShardInfo> shards, Hashing algo, Pattern key
5858
public void disconnect() {
5959
for (Jedis jedis : getAllShards()) {
6060
if (jedis.isConnected()) {
61+
try {
62+
// need a proper test, probably with mock
63+
if (!jedis.isBroken()) {
64+
jedis.quit();
65+
}
66+
} catch (JedisConnectionException e) {
67+
// ignore the exception node, so that all other normal nodes can release all connections.
68+
logger.warn("Error while QUIT", e);
69+
}
6170
try {
6271
jedis.disconnect();
6372
} catch (JedisConnectionException e) {
6473
// ignore the exception node, so that all other normal nodes can release all connections.
65-
logger.debug("Error while disconnect", e);
74+
logger.warn("Error while disconnect", e);
6675
}
6776
}
6877
}

src/main/java/redis/clients/jedis/ShardedJedisPool.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,18 @@ public void destroyObject(PooledObject<ShardedJedis> pooledShardedJedis) throws
8787
final ShardedJedis shardedJedis = pooledShardedJedis.getObject();
8888
for (Jedis jedis : shardedJedis.getAllShards()) {
8989
if (jedis.isConnected()) {
90+
try {
91+
// need a proper test, probably with mock
92+
if (!jedis.isBroken()) {
93+
jedis.quit();
94+
}
95+
} catch (RuntimeException e) {
96+
logger.warn("Error while QUIT", e);
97+
}
9098
try {
9199
jedis.disconnect();
92100
} catch (RuntimeException e) {
93-
logger.debug("Error while disconnect", e);
101+
logger.warn("Error while disconnect", e);
94102
}
95103
}
96104
}

0 commit comments

Comments
 (0)