aboutsummaryrefslogtreecommitdiff
path: root/discord/state.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2020-04-06 21:34:55 -0400
committerRapptz <[email protected]>2020-07-25 09:59:37 -0400
commit09ecb16680fe878b92f621016484614ddd88c0a1 (patch)
tree3e2e7307091dc2fa24136351ae7569897d776917 /discord/state.py
parentAdd revisions to check_once docs (diff)
downloaddiscord.py-09ecb16680fe878b92f621016484614ddd88c0a1.tar.xz
discord.py-09ecb16680fe878b92f621016484614ddd88c0a1.zip
Rewrite of AutoShardedClient to prevent overlapping identify
This is experimental and I'm unsure if it actually works
Diffstat (limited to 'discord/state.py')
-rw-r--r--discord/state.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/discord/state.py b/discord/state.py
index f84d85ba..6148889d 100644
--- a/discord/state.py
+++ b/discord/state.py
@@ -1047,6 +1047,7 @@ class AutoShardedConnectionState(ConnectionState):
super().__init__(*args, **kwargs)
self._ready_task = None
self.shard_ids = ()
+ self.shards_launched = asyncio.Event()
async def chunker(self, guild_id, query='', limit=0, *, shard_id=None, nonce=None):
ws = self._get_websocket(guild_id, shard_id=shard_id)
@@ -1073,6 +1074,7 @@ class AutoShardedConnectionState(ConnectionState):
log.info('Finished requesting guild member chunks for %d guilds.', len(guilds))
async def _delay_ready(self):
+ await self.shards_launched.wait()
launch = self._ready_state.launch
while True:
# this snippet of code is basically waiting 2 * shard_ids seconds