summaryrefslogtreecommitdiff
path: root/redis/connection.py
diff options
context:
space:
mode:
authorAndy McCurdy <andy@andymccurdy.com>2014-08-15 14:17:37 -0700
committerAndy McCurdy <andy@andymccurdy.com>2014-08-15 14:17:37 -0700
commitecf1e134266e6c87c449df08787aad163785cc13 (patch)
treeccf0313003c5def079e36df4727112953498f9fa /redis/connection.py
parentdcb524ea16087a8fd77c702a457e7f24d33899c9 (diff)
parenta68630780c88f710a008a0b5dc9760547c077bd6 (diff)
downloadredis-py-ecf1e134266e6c87c449df08787aad163785cc13.tar.gz
Merge branch 'pr/520'
Diffstat (limited to 'redis/connection.py')
-rwxr-xr-xredis/connection.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/redis/connection.py b/redis/connection.py
index 1169595..7486da8 100755
--- a/redis/connection.py
+++ b/redis/connection.py
@@ -556,13 +556,14 @@ class Connection(object):
"Pack and send a command to the Redis server"
self.send_packed_command(self.pack_command(*args))
- def can_read(self):
+ def can_read(self, timeout=0):
"Poll the socket to see if there's data that can be read."
sock = self._sock
if not sock:
self.connect()
sock = self._sock
- return bool(select([sock], [], [], 0)[0]) or self._parser.can_read()
+ return self._parser.can_read() or \
+ bool(select([sock], [], [], timeout)[0])
def read_response(self):
"Read the response from a previously sent command"