summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandy <andy@whiskeymedia.com>2013-05-06 00:01:44 -0700
committerandy <andy@whiskeymedia.com>2013-05-06 00:01:44 -0700
commit57f92d9df81cccc0a63bc0bf1a1f8d660e3fb76c (patch)
tree471a5c79f9e137c0e2637f39503ad50dd9cee49b
parentecef9adee36644002b4d0dd4e7c5ccae0ef4196a (diff)
downloadredis-py-57f92d9df81cccc0a63bc0bf1a1f8d660e3fb76c.tar.gz
can reuse the already existing parse_error routine to deal with LOADING errors.
-rw-r--r--redis/connection.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/redis/connection.py b/redis/connection.py
index 4a89894..e138d4c 100644
--- a/redis/connection.py
+++ b/redis/connection.py
@@ -36,8 +36,9 @@ class PythonParser(object):
EXCEPTION_CLASSES = {
'ERR': ResponseError,
- 'NOSCRIPT': NoScriptError,
'EXECABORT': ExecAbortError,
+ 'LOADING': ConnectionError,
+ 'NOSCRIPT': NoScriptError,
}
def __init__(self):
@@ -63,7 +64,7 @@ class PythonParser(object):
def read(self, length=None):
"""
- Read a line from the socket is no length is specified,
+ Read a line from the socket if no length is specified,
otherwise read ``length`` bytes. Always strip away the newlines.
"""
try:
@@ -114,10 +115,6 @@ class PythonParser(object):
# server returned an error
if byte == '-':
response = nativestr(response)
- if response.startswith('LOADING '):
- # if we're loading the dataset into memory, kill the socket
- # so we re-initialize (and re-SELECT) next time.
- raise ConnectionError("Redis is loading data into memory")
# *return*, not raise the exception class. if it is meant to be
# raised, it will be at a higher level.
return self.parse_error(response)