in redis/cluster.py [0:0]
def read(self):
""" """
connection = self.connection
for c in self.commands:
# if there is a result on this command,
# it means we ran into an exception
# like a connection error. Trying to parse
# a response on a connection that
# is no longer open will result in a
# connection error raised by redis-py.
# but redis-py doesn't check in parse_response
# that the sock object is
# still set and if you try to
# read from a closed connection, it will
# result in an AttributeError because
# it will do a readline() call on None.
# This can have all kinds of nasty side-effects.
# Treating this case as a connection error
# is fine because it will dump
# the connection object back into the
# pool and on the next write, it will
# explicitly open the connection and all will be well.
if c.result is None:
try:
c.result = self.parse_response(connection, c.args[0], **c.options)
except (ConnectionError, TimeoutError) as e:
for c in self.commands:
c.result = e
return
except RedisError:
c.result = sys.exc_info()[1]