Fixed - don't ping connection if it's in use.

pull/3848/head
Nikita Koksharov 3 years ago
parent fb4c30642e
commit fefabcc065

@ -49,7 +49,6 @@ public class RedisConnection implements RedisCommands {
private volatile RPromise<Void> fastReconnect;
private volatile boolean closed;
private volatile boolean queued;
volatile Channel channel;
private RPromise<?> connectionPromise;
@ -98,14 +97,6 @@ public class RedisConnection implements RedisCommands {
this.pooled = pooled;
}
public boolean isQueued() {
return queued;
}
public void setQueued(boolean queued) {
this.queued = queued;
}
public void setConnectedListener(Runnable connectedListener) {
this.connectedListener = connectedListener;
}

@ -61,9 +61,8 @@ public class PingConnectionHandler extends ChannelInboundHandlerAdapter {
private void sendPing(ChannelHandlerContext ctx) {
RedisConnection connection = RedisConnection.getFrom(ctx.channel());
CommandData<?, ?> commandData = connection.getCurrentCommand();
RFuture<String> future;
if ((commandData == null || !commandData.isBlockingCommand()) && !connection.isQueued()) {
if (connection.getUsage() == 0) {
future = connection.async(StringCodec.INSTANCE, RedisCommands.PING);
} else {
future = null;
@ -76,12 +75,6 @@ public class PingConnectionHandler extends ChannelInboundHandlerAdapter {
return;
}
CommandData<?, ?> commandData = connection.getCurrentCommand();
if (commandData != null && commandData.isBlockingCommand()) {
sendPing(ctx);
return;
}
if (future != null
&& (future.cancel(false) || !future.isSuccess())) {
ctx.channel().close();

@ -516,7 +516,6 @@ public class RedisExecutor<V, R> {
}
RedisConnection connection = connectionFuture.getNow();
connection.setQueued(false);
connectionManager.getShutdownLatch().release();
if (readOnlyMode) {
connectionManager.releaseRead(source, connection);

@ -132,8 +132,6 @@ public class RedisQueuedBatchExecutor<V, R> extends BaseRedisBatchExecutor<V, R>
@Override
protected void sendCommand(RPromise<R> attemptPromise, RedisConnection connection) {
connection.setQueued(true);
MasterSlaveEntry msEntry = getEntry(source);
ConnectionEntry connectionEntry = connections.get(msEntry);

Loading…
Cancel
Save