Skip to content

Commit

Permalink
Fixed - Spring Data Redis blocking poll commands can't be reattached …
Browse files Browse the repository at this point in the history
…after failover
  • Loading branch information
Nikita Koksharov committed May 9, 2024
1 parent 1f86d11 commit a82bd11
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
Expand Down Expand Up @@ -173,12 +174,22 @@ private void reattachBlockingQueue(CommandData<?, ?> commandData) {
for (int i = 0; i < commandData.getParams().length; i++) {
Object param = commandData.getParams()[i];
if ("STREAMS".equals(param)) {
key = (String) commandData.getParams()[i+1];
Object k = commandData.getParams()[i+1];
if (k instanceof byte[]) {
key = new String((byte[]) k, StandardCharsets.UTF_8);
} else {
key = (String) k;
}
break;
}
}
if (key == null) {
key = (String) commandData.getParams()[0];
Object k = commandData.getParams()[0];
if (k instanceof byte[]) {
key = new String((byte[]) k, StandardCharsets.UTF_8);
} else {
key = (String) k;
}
}

MasterSlaveEntry entry = connectionManager.getEntry(key);
Expand Down

0 comments on commit a82bd11

Please sign in to comment.