Skip to content

Commit 6d886d7

Browse files
authored
Fix issue 2660: PytestUnraisableExceptionWarning from asycio client (#2669)
1 parent 326bb1c commit 6d886d7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: redis/asyncio/client.py

+5
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,11 @@ async def reset(self):
702702
self.pending_unsubscribe_patterns = set()
703703

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

707712
async def on_connect(self, connection: Connection):

0 commit comments

Comments
 (0)