Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Commit

Permalink
Remove __del__ from Redis (Fixes #1115)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew-Chen-Wang committed Dec 2, 2021
1 parent dbdd0ad commit 6a34613
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions aioredis/client.py
Expand Up @@ -1054,16 +1054,6 @@ async def __aenter__(self: _RedisT) -> _RedisT:
async def __aexit__(self, exc_type, exc_value, traceback):
await self.close()

def __del__(self):
try:
loop = asyncio.get_event_loop()
if loop.is_running():
loop.create_task(self.close())
else:
loop.run_until_complete(self.close())
except Exception:
pass

async def close(self):
conn = self.connection
if conn:
Expand Down

0 comments on commit 6a34613

Please sign in to comment.