Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Include shard/presence metadata consistency. #807

Merged
merged 11 commits into from
May 28, 2022
6 changes: 3 additions & 3 deletions interactions/api/gateway/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ async def __restart(self):
self.__task.cancel()
self._client = None # clear pending waits
self.__heartbeater.event.clear()
await self._establish_connection()
await self._establish_connection(self.__shard, self.__presence)

async def _establish_connection(
self,
Expand All @@ -172,15 +172,15 @@ async def _establish_connection(
self._closed = self._client.closed

if self._closed:
await self._establish_connection()
await self._establish_connection(self.__shard, self.__presence)

while not self._closed:
stream = await self.__receive_packet_stream

if stream is None:
continue
if self._client is None or stream == WS_CLOSED_MESSAGE or stream == WSMsgType.CLOSE:
await self._establish_connection()
await self._establish_connection(self.__shard, self.__presence)
break

if self._client.close_code in range(4010, 4014) or self._client.close_code == 4004:
Expand Down