summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoey Prat <roey.prat@redislabs.com>2018-10-02 11:15:30 +0300
committerRoey Prat <roey.prat@redislabs.com>2018-10-20 10:33:10 +0300
commit91a80ac30ef3b1f11c836ed01da275cddcb8aff1 (patch)
treed0d6b5ea52b3c22f9807a841c7e1aa668c05e8bd
parent9ad89448d35cdb6bd1c94fecb40b74dba94084d6 (diff)
downloadredis-py-91a80ac30ef3b1f11c836ed01da275cddcb8aff1.tar.gz
xread: block parameter may be set to zero, to block indefinitely
-rwxr-xr-xredis/client.py4
-rw-r--r--tests/test_commands.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/redis/client.py b/redis/client.py
index 95dc63f..570d94d 100755
--- a/redis/client.py
+++ b/redis/client.py
@@ -1788,8 +1788,8 @@ class StrictRedis(object):
"""
pieces = []
if block is not None:
- if not isinstance(block, int) or block < 1:
- raise RedisError("XREAD block must be a positive integer")
+ if not isinstance(block, int) or block < 0:
+ raise RedisError("XREAD block must be a non-negative integer")
pieces.append("BLOCK")
pieces.append(str(block))
if count is not None:
diff --git a/tests/test_commands.py b/tests/test_commands.py
index 17b34c7..c78de8b 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -1662,7 +1662,7 @@ class TestStrictCommands(object):
results = sr.xread(varname='$', count=10, block=10)
assert results is None
- results = sr.xread(count=3, block=1000, **{varname: stamp1})
+ results = sr.xread(count=3, block=0, **{varname: stamp1})
assert results[varname][0][0] == stamp2
def test_strict_zadd(self, sr):