fix for closing

This commit is contained in:
Will McGugan
2022-05-19 11:21:43 +01:00
parent 1426d5994c
commit 1020b41717
6 changed files with 11 additions and 14 deletions

View File

@@ -198,13 +198,14 @@ class MessagePump:
return
self._closing = True
await self._message_queue.put(MessagePriority(None))
for task in self._child_tasks:
task.cancel()
await task
self._child_tasks.clear()
if self._task is not None:
# Ensure everything is closed before returning
await self._task
def start_messages(self) -> None:
self._task = asyncio.create_task(self.process_messages())