Timeout waiting for chunking.
Sometimes the bot would keep waiting for chunks that somehow finished before getting to the `wait` call. This is more so a temporary fix rather than a fully correct one.
This commit is contained in:
parent
6306fc08db
commit
a0f4ad36eb
@ -186,10 +186,16 @@ class ConnectionState:
|
|||||||
|
|
||||||
# wait for the chunks
|
# wait for the chunks
|
||||||
if chunks:
|
if chunks:
|
||||||
yield from asyncio.wait(chunks)
|
try:
|
||||||
|
yield from asyncio.wait(chunks, timeout=len(chunks))
|
||||||
|
except asyncio.TimeoutError:
|
||||||
|
log.info('Somehow timed out waiting for chunks.')
|
||||||
|
|
||||||
# remove the state
|
# remove the state
|
||||||
del self._ready_state
|
try:
|
||||||
|
del self._ready_state
|
||||||
|
except AttributeError:
|
||||||
|
pass # already been deleted somehow
|
||||||
|
|
||||||
# call GUILD_SYNC after we're done chunking
|
# call GUILD_SYNC after we're done chunking
|
||||||
if not self.is_bot:
|
if not self.is_bot:
|
||||||
@ -206,7 +212,7 @@ class ConnectionState:
|
|||||||
servers = self._ready_state.servers
|
servers = self._ready_state.servers
|
||||||
for guild in guilds:
|
for guild in guilds:
|
||||||
server = self._add_server_from_data(guild)
|
server = self._add_server_from_data(guild)
|
||||||
if server.large or not self.is_bot:
|
if not self.is_bot and server.large:
|
||||||
servers.append(server)
|
servers.append(server)
|
||||||
|
|
||||||
for pm in data.get('private_channels'):
|
for pm in data.get('private_channels'):
|
||||||
@ -291,7 +297,7 @@ class ConnectionState:
|
|||||||
if not reaction:
|
if not reaction:
|
||||||
log.warning("Unexpected reaction remove {}".format(data))
|
log.warning("Unexpected reaction remove {}".format(data))
|
||||||
return
|
return
|
||||||
|
|
||||||
reaction.count -= 1
|
reaction.count -= 1
|
||||||
if data['user_id'] == self.user.id:
|
if data['user_id'] == self.user.id:
|
||||||
reaction.me = False
|
reaction.me = False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user