DATAREDIS-1138 - Fix detection whether XREAD is blocking.

We now correctly check if a BLOCK option is configured using a timeout of zero or higher. Previously we only checked if the configured value is greater than zero and didn't consider that a timeout of zero blocks indefinitely.

Original Pull Request: #528
This commit is contained in:
Mark Paluch
2020-05-05 14:26:41 +02:00
committed by Christoph Strobl
parent 37ff71c320
commit 15259fd355
2 changed files with 2 additions and 2 deletions

View File

@@ -207,7 +207,7 @@ class LettuceReactiveStreamCommands implements ReactiveStreamCommands {
StreamReadOptions readOptions = command.getReadOptions();
if (readOptions.getBlock() != null && readOptions.getBlock() > 0) {
if (readOptions.getBlock() != null && readOptions.getBlock() >= 0) {
return new CommandResponse<>(command, connection.executeDedicated(cmd -> doRead(command, readOptions, cmd)));
}

View File

@@ -472,7 +472,7 @@ class LettuceStreamCommands implements RedisStreamCommands {
}
private static boolean isBlocking(StreamReadOptions readOptions) {
return readOptions.getBlock() != null && readOptions.getBlock() > 0;
return readOptions.getBlock() != null && readOptions.getBlock() >= 0;
}
@SuppressWarnings("unchecked")