Fix conv.wait_event not clearing timed out events

Closes #1618.
This commit is contained in:
Lonami Exo 2020-11-07 12:06:10 +01:00
parent b02a22eaa3
commit 08d5bfcbd0

View File

@ -336,7 +336,12 @@ class Conversation(ChatGetter):
future = self._client.loop.create_future() future = self._client.loop.create_future()
self._custom[counter] = (event, future) self._custom[counter] = (event, future)
try:
return await self._get_result(future, start_time, timeout, self._custom, counter) return await self._get_result(future, start_time, timeout, self._custom, counter)
except asyncio.TimeoutError:
# Need to remove it from the dict if it times out, else we may
# try and fail to set the result later (#1618).
del self._custom[counter]
async def _check_custom(self, built): async def _check_custom(self, built):
for key, (ev, fut) in list(self._custom.items()): for key, (ev, fut) in list(self._custom.items()):