Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* Fix #2749, remove unnecessary __del__ logic to close connections.
* Fix #2754, adding a missing argument to SentinelManagedConnection
* Fix `xadd` command to accept non-negative `maxlen` including 0
* Revert #2104, #2673, add `disconnect_on_error` option to `read_response()` (issues #2506, #2624)
Expand Down
18 changes: 0 additions & 18 deletions redis/asyncio/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,6 @@ def __init__(self, socket_read_size: int):
self._read_size = socket_read_size
self._connected = False

def __del__(self):
try:
self.on_disconnect()
except Exception:
pass

@classmethod
def parse_error(cls, response: str) -> ResponseError:
"""Parse an error response"""
Expand Down Expand Up @@ -570,18 +564,6 @@ def repr_pieces(self):
pieces.append(("client_name", self.client_name))
return pieces

def __del__(self):
try:
if self.is_connected:
loop = asyncio.get_running_loop()
coro = self.disconnect()
if loop.is_running():
loop.create_task(coro)
else:
loop.run_until_complete(coro)
except Exception:
pass

@property
def is_connected(self):
return self._reader is not None and self._writer is not None
Expand Down