Fixed - RedisTimeoutException: Command execution timeout for command: (PING) (regression since 3.16.3) #3867

pull/4099/head
Nikita Koksharov 3 years ago
parent 52843b1069
commit 69329c8dbd

@ -22,6 +22,7 @@ import org.redisson.api.RFuture;
import org.redisson.client.RedisClientConfig;
import org.redisson.client.RedisConnection;
import org.redisson.client.codec.StringCodec;
import org.redisson.client.protocol.CommandData;
import org.redisson.client.protocol.RedisCommands;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -58,7 +59,8 @@ public class PingConnectionHandler extends ChannelInboundHandlerAdapter {
private void sendPing(ChannelHandlerContext ctx) {
RedisConnection connection = RedisConnection.getFrom(ctx.channel());
RFuture<String> future;
if (connection.getUsage() == 0) {
CommandData<?, ?> currentCommand = connection.getCurrentCommand();
if (connection.getUsage() == 0 && (currentCommand == null || !currentCommand.isBlockingCommand())) {
future = connection.async(StringCodec.INSTANCE, RedisCommands.PING);
} else {
future = null;
@ -69,6 +71,12 @@ public class PingConnectionHandler extends ChannelInboundHandlerAdapter {
return;
}
CommandData<?, ?> cd = connection.getCurrentCommand();
if (cd != null && cd.isBlockingCommand()) {
sendPing(ctx);
return;
}
if (connection.getUsage() == 0
&& future != null
&& (future.cancel(false) || !future.isSuccess())) {

Loading…
Cancel
Save