Skip to content

Commit

Permalink
Revert change to Redis() object
Browse files Browse the repository at this point in the history
  • Loading branch information
kristjanvalur committed Dec 15, 2022
1 parent 6bada77 commit 8cbd128
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
13 changes: 2 additions & 11 deletions redis/asyncio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,17 +477,8 @@ async def _send_command_parse_response(self, conn, command_name, *args, **option
"""
Send a command and parse the response
"""
try:
await conn.send_command(*args)
return await self.parse_response(conn, command_name, **options)
except BaseException:
# An exception while reading or writing leaves the connection in
# an unknown state. There may be un-written or un-read data
# so we cannot re-use it for a subsequent command/response transaction.
# This may be a TimeoutError or any other error not handled by the
# Connection object itself.
await conn.disconnect(nowait=True)
raise
await conn.send_command(*args)
return await self.parse_response(conn, command_name, **options)

async def _disconnect_raise(self, conn: Connection, error: Exception):
"""
Expand Down
14 changes: 2 additions & 12 deletions redis/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1231,18 +1231,8 @@ def _send_command_parse_response(self, conn, command_name, *args, **options):
"""
Send a command and parse the response
"""
try:
conn.send_command(*args)
return self.parse_response(conn, command_name, **options)
except BaseException:
# An exception while reading or writing leaves the connection in
# an unknown state. There may be un-written or un-read data
# so we cannot re-use it for a subsequent command/response transaction.
# This can be any error not handled by the Connection itself, such
# as BaseExceptions may have been used to interrupt IO, when using
# gevent.
conn.disconnect()
raise
conn.send_command(*args)
return self.parse_response(conn, command_name, **options)

def _disconnect_raise(self, conn, error):
"""
Expand Down

0 comments on commit 8cbd128

Please sign in to comment.