Skip to content

Commit

Permalink
Fixed - Spring Data Redis StreamPollTask.deserializeAndEmitRecords me…
Browse files Browse the repository at this point in the history
…thod throws NPE after failover #4006
  • Loading branch information
Nikita Koksharov committed May 9, 2024
1 parent 4eba623 commit 1f86d11
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions redisson/src/main/java/org/redisson/command/RedisExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import org.redisson.client.protocol.CommandsData;
import org.redisson.client.protocol.RedisCommand;
import org.redisson.client.protocol.RedisCommands;
import org.redisson.client.protocol.decoder.ListMultiDecoder2;
import org.redisson.client.protocol.decoder.ObjectListReplayDecoder;
import org.redisson.connection.ClientConnectionsEntry;
import org.redisson.connection.ConnectionManager;
import org.redisson.connection.MasterSlaveEntry;
Expand All @@ -42,10 +44,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.BiConsumer;

Expand Down Expand Up @@ -461,7 +460,12 @@ private void handleBlockingOperations(CompletableFuture<R> attemptPromise, Redis
if (popTimeout != 0) {
// handling cases when connection has been lost
scheduledFuture = connectionManager.getServiceManager().newTimeout(timeout -> {
if (attemptPromise.complete(null)) {
R res = null;
if (command.getReplayMultiDecoder() instanceof ObjectListReplayDecoder
|| command.getReplayMultiDecoder() instanceof ListMultiDecoder2) {
res = (R) Collections.emptyList();
}
if (attemptPromise.complete(res)) {
connection.forceFastReconnectAsync();
}
}, popTimeout + 3000, TimeUnit.MILLISECONDS);
Expand Down

0 comments on commit 1f86d11

Please sign in to comment.