Skip to content

Commit

Permalink
Fix issue 2660: PytestUnraisableExceptionWarning from asycio client (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
shacharPash committed Mar 28, 2023
1 parent 326bb1c commit 6d886d7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions redis/asyncio/client.py
Expand Up @@ -702,6 +702,11 @@ async def reset(self):
self.pending_unsubscribe_patterns = set()

def close(self) -> Awaitable[NoReturn]:
# In case a connection property does not yet exist
# (due to a crash earlier in the Redis() constructor), return
# immediately as there is nothing to clean-up.
if not hasattr(self, "connection"):
return
return self.reset()

async def on_connect(self, connection: Connection):
Expand Down

0 comments on commit 6d886d7

Please sign in to comment.