diff options
| author | Rapptz <[email protected]> | 2016-12-24 17:32:07 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2016-12-24 17:32:20 -0500 |
| commit | a8264f654092ed117564d5cd709aac7d4fee8ea9 (patch) | |
| tree | ae0f185102df60b7a6ccbb76bac70f92f4ea849a | |
| parent | Support animated avatars in User.avatar_url. (diff) | |
| download | discord.py-a8264f654092ed117564d5cd709aac7d4fee8ea9.tar.xz discord.py-a8264f654092ed117564d5cd709aac7d4fee8ea9.zip | |
Chunk every guild if it's a user bot.
This also increases the timeout for chunking by 30 seconds for every
chunk we're waiting for.
| -rw-r--r-- | discord/state.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/discord/state.py b/discord/state.py index 48a75a47..60e9e5f5 100644 --- a/discord/state.py +++ b/discord/state.py @@ -187,7 +187,7 @@ class ConnectionState: # wait for the chunks if chunks: try: - yield from asyncio.wait(chunks, timeout=len(chunks), loop=self.loop) + yield from asyncio.wait(chunks, timeout=len(chunks) * 30.0, loop=self.loop) except asyncio.TimeoutError: log.info('Somehow timed out waiting for chunks.') @@ -199,7 +199,8 @@ class ConnectionState: # call GUILD_SYNC after we're done chunking if not self.is_bot: - compat.create_task(self.syncer([s.id for s in self.servers]), loop=self.loop) + log.info('Requesting GUILD_SYNC for %s guilds' % len(self.servers)) + yield from self.syncer([s.id for s in self.servers]) # dispatch the event self.dispatch('ready') @@ -212,7 +213,7 @@ class ConnectionState: servers = self._ready_state.servers for guild in guilds: server = self._add_server_from_data(guild) - if not self.is_bot and server.large: + if not self.is_bot or server.large: servers.append(server) for pm in data.get('private_channels'): |