test: close the loop after the network thread has completed

https://docs.python.org/3.15/library/asyncio-eventloop.html#asyncio.loop.close
reads "The loop must not be running when this function is called". It
seems safer to call `close()` after the thread has exited.
This commit is contained in:
Vasil Dimov
2026-06-22 18:39:28 +02:00
parent 29fba5ddbb
commit e4d80e7001

View File

@@ -774,8 +774,8 @@ class NetworkThread(threading.Thread):
self.network_event_loop.call_soon_threadsafe(self.network_event_loop.stop)
wait_until_helper_internal(lambda: not self.network_event_loop.is_running(), timeout=timeout)
self.network_event_loop.close()
self.join(timeout)
self.network_event_loop.close()
# Safe to remove event loop.
NetworkThread.network_event_loop = None