DATAREDIS-1231 - Use Jedis command routing if multiple BRPOP keys map to a single slot.

Original pull request: #568.
This commit is contained in:
jot.zhao
2020-10-09 12:00:24 +08:00
committed by Mark Paluch
parent 41136c6934
commit ead954a743

View File

@@ -303,6 +303,14 @@ class JedisClusterListCommands implements RedisListCommands {
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<List<byte[]>>) (client, key) -> client.brpop(timeout, key),