Skip to content

Commit 46fe03e

Browse files
jotzhaomp911de
authored andcommitted
DATAREDIS-1231 - Use Jedis command routing if multiple BRPOP keys map to a single slot.
Original pull request: #568.
1 parent b1a857f commit 46fe03e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterListCommands.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,14 @@ public List<byte[]> bRPop(int timeout, byte[]... keys) {
287287
Assert.notNull(keys, "Key must not be null!");
288288
Assert.noNullElements(keys, "Keys must not contain null elements!");
289289

290+
if (ClusterSlotHashUtil.isSameSlotForAllKeys(keys)) {
291+
try {
292+
return connection.getCluster().brpop(timeout,keys);
293+
} catch (Exception ex) {
294+
throw convertJedisAccessException(ex);
295+
}
296+
}
297+
290298
return connection.getClusterCommandExecutor()
291299
.executeMultiKeyCommand(
292300
(JedisMultiKeyClusterCommandCallback<List<byte[]>>) (client, key) -> client.brpop(timeout, key),

0 commit comments

Comments
 (0)