move unregister

This commit is contained in:
Will McGugan
2022-08-06 14:15:09 +01:00
parent 6d94b51a95
commit f4de84ad87
2 changed files with 1 additions and 2 deletions

View File

@@ -216,10 +216,8 @@ class MessagePump:
"""Close message queue, and optionally wait for queue to finish processing."""
if self._closed or self._closing:
return
print(self, "close_messages")
self._closing = True
await self._message_queue.put(MessagePriority(None))
self.app._unregister(self)
cancel_tasks = list(self._child_tasks)
for task in cancel_tasks:
task.cancel()