mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-13 17:29:50 +00:00
Fix oversight where on_disconnect did not get called on WS termination.
This commit is contained in:
parent
f8999b63ae
commit
61ee88b0fc
@ -382,6 +382,7 @@ class Client:
|
|||||||
await self.ws.poll_event()
|
await self.ws.poll_event()
|
||||||
except ResumeWebSocket:
|
except ResumeWebSocket:
|
||||||
log.info('Got a request to RESUME the websocket.')
|
log.info('Got a request to RESUME the websocket.')
|
||||||
|
self.dispatch('disconnect')
|
||||||
coro = DiscordWebSocket.from_client(self, shard_id=self.shard_id, session=self.ws.session_id,
|
coro = DiscordWebSocket.from_client(self, shard_id=self.shard_id, session=self.ws.session_id,
|
||||||
sequence=self.ws.sequence, resume=True)
|
sequence=self.ws.sequence, resume=True)
|
||||||
self.ws = await asyncio.wait_for(coro, timeout=180.0, loop=self.loop)
|
self.ws = await asyncio.wait_for(coro, timeout=180.0, loop=self.loop)
|
||||||
|
@ -43,6 +43,7 @@ class Shard:
|
|||||||
def __init__(self, ws, client):
|
def __init__(self, ws, client):
|
||||||
self.ws = ws
|
self.ws = ws
|
||||||
self._client = client
|
self._client = client
|
||||||
|
self._dispatch = client.dispatch
|
||||||
self.loop = self._client.loop
|
self.loop = self._client.loop
|
||||||
self._current = self.loop.create_future()
|
self._current = self.loop.create_future()
|
||||||
self._current.set_result(None) # we just need an already done future
|
self._current.set_result(None) # we just need an already done future
|
||||||
@ -79,6 +80,7 @@ class Shard:
|
|||||||
log.info('Got a request to RESUME the websocket at Shard ID %s.', self.id)
|
log.info('Got a request to RESUME the websocket at Shard ID %s.', self.id)
|
||||||
coro = DiscordWebSocket.from_client(self._client, resume=True, shard_id=self.id,
|
coro = DiscordWebSocket.from_client(self._client, resume=True, shard_id=self.id,
|
||||||
session=self.ws.session_id, sequence=self.ws.sequence)
|
session=self.ws.session_id, sequence=self.ws.sequence)
|
||||||
|
self._dispatch('disconnect')
|
||||||
self.ws = await asyncio.wait_for(coro, timeout=180.0, loop=self.loop)
|
self.ws = await asyncio.wait_for(coro, timeout=180.0, loop=self.loop)
|
||||||
|
|
||||||
def get_future(self):
|
def get_future(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user