Skip to content

Commit ead954a

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 41136c6 commit ead954a

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
@@ -303,6 +303,14 @@ public List<byte[]> bRPop(int timeout, byte[]... keys) {
303303
Assert.notNull(keys, "Key must not be null!");
304304
Assert.noNullElements(keys, "Keys must not contain null elements!");
305305

306+
if (ClusterSlotHashUtil.isSameSlotForAllKeys(keys)) {
307+
try {
308+
return connection.getCluster().brpop(timeout,keys);
309+
} catch (Exception ex) {
310+
throw convertJedisAccessException(ex);
311+
}
312+
}
313+
306314
return connection.getClusterCommandExecutor()
307315
.executeMultiKeyCommand(
308316
(JedisMultiKeyClusterCommandCallback<List<byte[]>>) (client, key) -> client.brpop(timeout, key),

0 commit comments

Comments
 (0)