diff options
| author | Rapptz <[email protected]> | 2017-02-08 04:37:16 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-02-08 04:37:16 -0500 |
| commit | dc486980f87249583a38a22c79aa0f7370b75d55 (patch) | |
| tree | e2c6b091c40469e51e358b0c736bd81e29137e4f /discord/client.py | |
| parent | Only defer the lock if we're pre-emptively rate limiting. (diff) | |
| download | discord.py-dc486980f87249583a38a22c79aa0f7370b75d55.tar.xz discord.py-dc486980f87249583a38a22c79aa0f7370b75d55.zip | |
Rewrite RESUME logic to be more in line with what is requested.
Apparently we should always try to RESUME first and if we get
INVALIDATE_SESSION then we should IDENTIFY instead. This is the
preferred way to do RESUMEs.
Diffstat (limited to 'discord/client.py')
| -rw-r--r-- | discord/client.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/discord/client.py b/discord/client.py index 8cf5d00b..758ab217 100644 --- a/discord/client.py +++ b/discord/client.py @@ -361,17 +361,12 @@ class Client: while not self.is_closed(): try: yield from self.ws.poll_event() - except (ReconnectWebSocket, ResumeWebSocket) as e: - resume = type(e) is ResumeWebSocket - log.info('Got ' + type(e).__name__) - - if not resume: - self._ready.clear() - + except ResumeWebSocket as e: + log.info('Got a request to RESUME the websocket.') self.ws = yield from DiscordWebSocket.from_client(self, shard_id=self.shard_id, session=self.ws.session_id, sequence=self.ws.sequence, - resume=resume) + resume=True) except ConnectionClosed as e: yield from self.close() if e.code != 1000: |