fixed memory leak when session.send coroutine is cancelled (#311)

added that when session.send coroutine is cancelled (or if any other exception is raised) the result should still be removed from the results list
This commit is contained in:
YoilyL 2019-09-09 16:56:57 +03:00 committed by Dan
parent 8f0b8babc2
commit aa937a704d

View File

@ -382,8 +382,8 @@ class Session:
await asyncio.wait_for(self.results[msg_id].event.wait(), timeout)
except asyncio.TimeoutError:
pass
result = self.results.pop(msg_id).value
finally:
result = self.results.pop(msg_id).value
if result is None:
raise TimeoutError