Skip to content

Commit

Permalink
Removed socket retry logic in Connection. This is the responsbility o…
Browse files Browse the repository at this point in the history
…f the caller to determine if the command is safe and can be retried.
  • Loading branch information
andy committed Jul 22, 2011
1 parent 907555c commit dbd2217
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGES
@@ -1,3 +1,7 @@
* 2.4.9 (in development)
* Removed socket retry logic in Connection. This is the responsbility of
the caller to determine if the command is safe and can be retried. Thanks
David Wolver.
* 2.4.8
* Imported with_statement from __future__ for Python 2.5 compatability.
* 2.4.7
Expand Down
15 changes: 2 additions & 13 deletions redis/connection.py
Expand Up @@ -174,8 +174,8 @@ def disconnect(self):
pass
self._sock = None

def _send(self, command):
"Send the command to the socket"
def send_packed_command(self, command):
"Send an already packed command to the Redis server"
if not self._sock:
self.connect()
try:
Expand All @@ -190,17 +190,6 @@ def _send(self, command):
raise ConnectionError("Error %s while writing to socket. %s." % \
(_errno, errmsg))

def send_packed_command(self, command):
"Send an already packed command to the Redis server"
try:
self._send(command)
except ConnectionError:
# retry the command once in case the socket connection simply
# timed out
self.disconnect()
# if this _send() call fails, then the error will be raised
self._send(command)

def send_command(self, *args):
"Pack and send a command to the Redis server"
self.send_packed_command(self.pack_command(*args))
Expand Down

0 comments on commit dbd2217

Please sign in to comment.