diff --git a/src/main/java/io/lettuce/core/protocol/DefaultEndpoint.java b/src/main/java/io/lettuce/core/protocol/DefaultEndpoint.java index b656a205cc..c08574113e 100644 --- a/src/main/java/io/lettuce/core/protocol/DefaultEndpoint.java +++ b/src/main/java/io/lettuce/core/protocol/DefaultEndpoint.java @@ -404,17 +404,13 @@ private void writeToChannelAndFlush(Channel channel, Collection command : commands) { - channelWrite(channel, command).addListener(AtMostOnceWriteListener.newInstance(this, command)); - } + channelWrite(channel, commands).addListener(AtMostOnceWriteListener.newInstance(this, commands)); } if (reliability == Reliability.AT_LEAST_ONCE) { // commands are ok to stay within the queue, reconnect will retrigger them - for (RedisCommand command : commands) { - channelWrite(channel, command).addListener(RetryListener.newInstance(this, command)); - } + channelWrite(channel, commands).addListener(RetryListener.newInstance(this, commands)); } channelFlush(channel); @@ -438,6 +434,15 @@ private ChannelFuture channelWrite(Channel channel, RedisCommand comman return channel.write(command); } + private ChannelFuture channelWrite(Channel channel, Collection> commands) { + + if (debugEnabled) { + logger.debug("{} write() channelWrite command {}", logPrefix(), commands); + } + + return channel.write(commands); + } + private ChannelFuture channelWriteAndFlush(Channel channel, RedisCommand command) { if (debugEnabled) {