diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterListCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterListCommands.java index 77a5202c3e..df51e1ed11 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterListCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisClusterListCommands.java @@ -303,6 +303,14 @@ public List bRPop(int timeout, byte[]... keys) { Assert.notNull(keys, "Key must not be null!"); Assert.noNullElements(keys, "Keys must not contain null elements!"); + if (ClusterSlotHashUtil.isSameSlotForAllKeys(keys)) { + try { + return connection.getCluster().brpop(timeout,keys); + } catch (Exception ex) { + throw convertJedisAccessException(ex); + } + } + return connection.getClusterCommandExecutor() .executeMultiKeyCommand( (JedisMultiKeyClusterCommandCallback>) (client, key) -> client.brpop(timeout, key),