mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-20 16:00:29 +00:00
Change default close code to 4000 instead of 1000.
This prevents our sessions from being invalidated by Discord which caused a lot of failures when resuming. This caused an unnecessary amount of IDENTIFYs to happen depending on the circumstances. Closes #2631 See also discord/discord-api-docs#1472
This commit is contained in:
parent
aea9c2aebf
commit
403651a144
@ -549,7 +549,7 @@ class Client:
|
||||
pass
|
||||
|
||||
if self.ws is not None and self.ws.open:
|
||||
await self.ws.close()
|
||||
await self.ws.close(code=1000)
|
||||
|
||||
self._ready.clear()
|
||||
|
||||
|
@ -543,7 +543,7 @@ class DiscordWebSocket(websockets.client.WebSocketClientProtocol):
|
||||
log.debug('Updating our voice state to %s.', payload)
|
||||
await self.send_as_json(payload)
|
||||
|
||||
async def close(self, code=1000, reason=''):
|
||||
async def close(self, code=4000, reason=''):
|
||||
if self._keep_alive:
|
||||
self._keep_alive.stop()
|
||||
|
||||
|
@ -290,7 +290,7 @@ class AutoShardedClient(Client):
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
to_close = [asyncio.ensure_future(shard.ws.close(), loop=self.loop) for shard in self.shards.values()]
|
||||
to_close = [asyncio.ensure_future(shard.ws.close(code=1000), loop=self.loop) for shard in self.shards.values()]
|
||||
if to_close:
|
||||
await asyncio.wait(to_close)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user