diff options
author | Andy McCurdy <andy@andymccurdy.com> | 2014-08-15 14:17:37 -0700 |
---|---|---|
committer | Andy McCurdy <andy@andymccurdy.com> | 2014-08-15 14:17:37 -0700 |
commit | ecf1e134266e6c87c449df08787aad163785cc13 (patch) | |
tree | ccf0313003c5def079e36df4727112953498f9fa /redis/connection.py | |
parent | dcb524ea16087a8fd77c702a457e7f24d33899c9 (diff) | |
parent | a68630780c88f710a008a0b5dc9760547c077bd6 (diff) | |
download | redis-py-ecf1e134266e6c87c449df08787aad163785cc13.tar.gz |
Merge branch 'pr/520'
Diffstat (limited to 'redis/connection.py')
-rwxr-xr-x | redis/connection.py | 5 |
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" |