diff --git a/CHANGES b/CHANGES index 1e03453cc3..7fd510bd12 100644 --- a/CHANGES +++ b/CHANGES @@ -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) diff --git a/redis/asyncio/connection.py b/redis/asyncio/connection.py index 462673f2ed..4ba177ef26 100644 --- a/redis/asyncio/connection.py +++ b/redis/asyncio/connection.py @@ -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""" @@ -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