-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Closed
Description
Expected behavior
According to redis documentation when passing block=0 to xread command, the operation should block forever (until has data to read).
From the documentation:
"... I specified the new BLOCK option with a timeout of 0 milliseconds (that means to never timeout)"
In Jedis, when I pass block=0 it seems like the BLOCK param is omitted at all from the sent command thus the xread command won't block at all.
BinaryClient.java:
public void xread(final int count, final long block, final Map<byte[], byte[]> streams) {
...
if(block > 0) {
params[streamsIndex++] = Keyword.BLOCK.raw;
params[streamsIndex++] = toByteArray(block);
}
...I also validate this behavior with the python client and redis-cli and indeed block=0 means block forever.
I guess the block argument to Jedis.xread should be optional, when provided it should be passed to redis for any value >= 0 (negative value are not allowed)
Redis / Jedis Configuration
Jedis version: 3.3.0
Redis version: 5.10
Java version: 11
Thanks.