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-28 12:12:53 +0200
commit644de16c16bfef7ce80dde1d2d718d91a6eae308 (patch)
tree48ec7460e3b77e68e0b05c4307e2f9bb9cba4023
parent832c296f73bcdcf51b420bb3683ff62d1b43767b (diff)
downloadredis-py-644de16c16bfef7ce80dde1d2d718d91a6eae308.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):