summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy McCurdy <andy@andymccurdy.com>2015-09-28 15:34:29 -0700
committerAndy McCurdy <andy@andymccurdy.com>2015-09-28 15:34:29 -0700
commited2a079cc3ff7db82e197307d388ca9c96cb092e (patch)
tree2fec24357bdcf1558feb0fcfd0a0beded958d6a3
parentf6338499b2d390dcb25c8835f9418f63794be2a5 (diff)
downloadredis-py-ed2a079cc3ff7db82e197307d388ca9c96cb092e.tar.gz
removed the proactive check in HiredisParser for a line ending
it turns out just calling into hiredis to test this is faster than doing string compare in Python. fixes #615 and #650.
-rw-r--r--CHANGES4
-rwxr-xr-xredis/connection.py9
2 files changed, 4 insertions, 9 deletions
diff --git a/CHANGES b/CHANGES
index f7060b6..44c17df 100644
--- a/CHANGES
+++ b/CHANGES
@@ -15,6 +15,10 @@
to the master when the connection pool resets. Thanks
https://github.com/df3n5
* Better timeout support in Pubsub get_message. Thanks Andy Isaacson.
+ * Fixed a bug with the HiredisParser that would cause the parser to
+ get stuck in an endless loop if a specific number of bytes were
+ delivered from the socket. This fix also increases performance of
+ parsing large responses from the Redis server.
* 2.10.3
* Fixed a bug with the bytearray support introduced in 2.10.2. Thanks
Josh Owen.
diff --git a/redis/connection.py b/redis/connection.py
index 0229d28..19d6925 100755
--- a/redis/connection.py
+++ b/redis/connection.py
@@ -346,15 +346,6 @@ class HiredisParser(BaseParser):
self._reader.feed(self._buffer, 0, bufflen)
else:
self._reader.feed(buffer)
- # proactively, but not conclusively, check if more data is in the
- # buffer. if the data received doesn't end with \r\n, there's more.
- if HIREDIS_USE_BYTE_BUFFER:
- if bufflen > 2 and \
- self._buffer[bufflen - 2:bufflen] != SYM_CRLF:
- continue
- else:
- if not buffer.endswith(SYM_CRLF):
- continue
response = self._reader.gets()
# if an older version of hiredis is installed, we need to attempt
# to convert ResponseErrors to their appropriate types.