Skip to content

Commit

Permalink
fixes context exit
Browse files Browse the repository at this point in the history
  • Loading branch information
David Erb committed Jun 8, 2023
1 parent 019b252 commit 72190cd
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/echolocator_lib/guis/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,21 @@ async def aenter(self):
await self.server.start_process()

# ----------------------------------------------------------------------------------------
async def aexit(self, type, value, traceback):
""" """
async def aexit(self, type=None, value=None, traceback=None):
"""
Asyncio context exit.
Stop service if one was started and releases any client resources.
"""
logger.debug(f"[DISSHU] {thing_type} aexit")

if self.server is not None:
if self.context_specification.get("start_as") == "process":
logger.debug(f"[DISSHU] {thing_type} calling client_shutdown")
# Put in request to shutdown the server.
await self.server.client_shutdown()
# The server associated with this context is running?
if await self.is_process_alive():
logger.debug(f"[DISSHU] {thing_type} calling client_shutdown")
# Put in request to shutdown the server.
await self.server.client_shutdown()

if self.context_specification.get("start_as") == "coro":
await self.server.direct_shutdown()

0 comments on commit 72190cd

Please sign in to comment.