Skip to content

Commit

Permalink
need to detect READONLY errors in read_response, now send_command. re…
Browse files Browse the repository at this point in the history
…al fix

for redis#435
  • Loading branch information
andymccurdy committed Jun 2, 2014
1 parent 2114574 commit 96f08d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
* 2.10.1
* Fixed a bug where Sentinel connections to a server that's no longer a
master and receives a READONLY error will disconnect and reconnect to
the master.
* 2.10.0
* Discontinuted support for Python 2.5. Upgrade. You'll be happier.
* The HiRedis parser will now properly raise ConnectionErrors.
Expand Down
4 changes: 2 additions & 2 deletions redis/sentinel.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ def connect(self):
continue
raise SlaveNotFoundError # Never be here

def send_command(self, *args):
def read_response(self):
try:
super(SentinelManagedConnection, self).send_command(*args)
return super(SentinelManagedConnection, self).read_response()
except ReadOnlyError:
if self.connection_pool.is_master:
# When talking to a master, a ReadOnlyError when likely
Expand Down

0 comments on commit 96f08d7

Please sign in to comment.