Move all async object creation to a proper initialisation point

This should make it so no object is created with another loop
This commit is contained in:
Rapptz
2022-03-13 08:26:39 -04:00
parent 8d4f08a5e7
commit 9c61e10a55
4 changed files with 45 additions and 27 deletions

View File

@@ -343,8 +343,7 @@ class HTTPClient:
self.connector: aiohttp.BaseConnector = connector or MISSING
self.__session: aiohttp.ClientSession = MISSING # filled in static_login
self._locks: weakref.WeakValueDictionary = weakref.WeakValueDictionary()
self._global_over: asyncio.Event = asyncio.Event()
self._global_over.set()
self._global_over: asyncio.Event = MISSING
self.token: Optional[str] = None
self.bot_token: bool = False
self.proxy: Optional[str] = proxy
@@ -550,6 +549,9 @@ class HTTPClient:
self.__session = aiohttp.ClientSession(
connector=self.connector, ws_response_class=DiscordClientWebSocketResponse, loop=self.loop
)
self._global_over = asyncio.Event()
self._global_over.set()
old_token = self.token
self.token = token