Add heartbeat_timeout to the Client options.

This setting configures how long before a timeout event is emitted
internally and disconnects the websocket. Since some users were
experiencing issues with the gateway not responding, this should help
mitigate the issue for those with poor PCs.
This commit is contained in:
Rapptz
2017-08-08 21:12:04 -04:00
parent ceafae0ab2
commit de65f7309b
4 changed files with 11 additions and 2 deletions

View File

@ -64,6 +64,7 @@ class ConnectionState:
self.shard_count = None
self._ready_task = None
self._fetch_offline = options.get('fetch_offline_members', True)
self.heartbeat_timeout = options.get('heartbeat_timeout', 60.0)
self._listeners = []
game = options.get('game', None)
@ -907,7 +908,6 @@ class AutoShardedConnectionState(ConnectionState):
launch.set()
yield from asyncio.sleep(2.0 * self.shard_count, loop=self.loop)
if self._fetch_offline:
guilds = sorted(self._ready_state.guilds, key=lambda g: g.shard_id)