File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -38,15 +38,21 @@ async def aenter(self):
38
38
await self .server .start_process ()
39
39
40
40
# ----------------------------------------------------------------------------------------
41
- async def aexit (self , type , value , traceback ):
42
- """ """
41
+ async def aexit (self , type = None , value = None , traceback = None ):
42
+ """
43
+ Asyncio context exit.
44
+
45
+ Stop service if one was started and releases any client resources.
46
+ """
43
47
logger .debug (f"[DISSHU] { thing_type } aexit" )
44
48
45
49
if self .server is not None :
46
50
if self .context_specification .get ("start_as" ) == "process" :
47
- logger .debug (f"[DISSHU] { thing_type } calling client_shutdown" )
48
- # Put in request to shutdown the server.
49
- await self .server .client_shutdown ()
51
+ # The server associated with this context is running?
52
+ if await self .is_process_alive ():
53
+ logger .debug (f"[DISSHU] { thing_type } calling client_shutdown" )
54
+ # Put in request to shutdown the server.
55
+ await self .server .client_shutdown ()
50
56
51
57
if self .context_specification .get ("start_as" ) == "coro" :
52
58
await self .server .direct_shutdown ()
You can’t perform that action at this time.
0 commit comments