mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-06-09 06:50: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:
|
def asyncio_loop_thread(loop: asyncio.AbstractEventLoop) -> None:
|
||||||
asyncio.set_event_loop(loop)
|
asyncio.set_event_loop(loop)
|
||||||
|
try:
|
||||||
loop.run_forever()
|
loop.run_forever()
|
||||||
|
finally:
|
||||||
|
loop.close()
|
||||||
|
|
||||||
|
|
||||||
class Client:
|
class Client:
|
||||||
|
@ -182,7 +182,10 @@ class Server:
|
|||||||
|
|
||||||
This method should be called to start the server after it's been instantiated.
|
This method should be called to start the server after it's been instantiated.
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
self._loop.run_until_complete(self.serve())
|
self._loop.run_until_complete(self.serve())
|
||||||
|
finally:
|
||||||
|
self._loop.close()
|
||||||
|
|
||||||
async def serve(self) -> None:
|
async def serve(self) -> None:
|
||||||
process_id = os.getpid()
|
process_id = os.getpid()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user