From 1c9c5bb5a3c25cc4e7c823f8ca42bc89b7dfaa70 Mon Sep 17 00:00:00 2001 From: Honza Javorek Date: Wed, 23 Oct 2024 19:51:11 +0200 Subject: [PATCH] fix: prevent unclosed client session / unclosed connector (#2618) Takes inspiration from https://github.com/Rapptz/discord.py/pull/1967 Fixes https://github.com/Pycord-Development/pycord/issues/2399 --- discord/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/client.py b/discord/client.py index 8ece21cf94..1520952f04 100644 --- a/discord/client.py +++ b/discord/client.py @@ -714,6 +714,7 @@ async def close(self) -> None: if self._closed: return + await self.http.close() self._closed = True for voice in self.voice_clients: @@ -726,7 +727,6 @@ async def close(self) -> None: if self.ws is not None and self.ws.open: await self.ws.close(code=1000) - await self.http.close() self._ready.clear() def clear(self) -> None: