Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/main/java/io/lettuce/core/protocol/DefaultEndpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -404,17 +404,13 @@ private void writeToChannelAndFlush(Channel channel, Collection<? extends RedisC
if (reliability == Reliability.AT_MOST_ONCE) {

// cancel on exceptions and remove from queue, because there is no housekeeping
for (RedisCommand<?, ?, ?> 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);
Expand All @@ -438,6 +434,15 @@ private ChannelFuture channelWrite(Channel channel, RedisCommand<?, ?, ?> comman
return channel.write(command);
}

private ChannelFuture channelWrite(Channel channel, Collection<? extends RedisCommand<?, ?, ?>> commands) {

if (debugEnabled) {
logger.debug("{} write() channelWrite command {}", logPrefix(), commands);
}

return channel.write(commands);
}

private ChannelFuture channelWriteAndFlush(Channel channel, RedisCommand<?, ?, ?> command) {

if (debugEnabled) {
Expand Down