mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-06-05 21:20:40 +02:00
properly closing event loops in client and server
This commit is contained in:
parent
c5eb5f80b4
commit
7c18d86e9c
@ -33,7 +33,10 @@ class NotifyDict(TypedDict):
|
||||
|
||||
def asyncio_loop_thread(loop: asyncio.AbstractEventLoop) -> None:
|
||||
asyncio.set_event_loop(loop)
|
||||
loop.run_forever()
|
||||
try:
|
||||
loop.run_forever()
|
||||
finally:
|
||||
loop.close()
|
||||
|
||||
|
||||
class Client:
|
||||
|
@ -182,7 +182,10 @@ class Server:
|
||||
|
||||
This method should be called to start the server after it's been instantiated.
|
||||
"""
|
||||
self._loop.run_until_complete(self.serve())
|
||||
try:
|
||||
self._loop.run_until_complete(self.serve())
|
||||
finally:
|
||||
self._loop.close()
|
||||
|
||||
async def serve(self) -> None:
|
||||
process_id = os.getpid()
|
||||
|
Loading…
x
Reference in New Issue
Block a user