File tree Expand file tree Collapse file tree 1 file changed +2
-10
lines changed Expand file tree Collapse file tree 1 file changed +2
-10
lines changed Original file line number Diff line number Diff line change 44
55import asyncio
66import os
7- import time
87import traceback
98from contextlib import suppress
109
@@ -569,10 +568,6 @@ async def async_stop(cls):
569568 if not cls .active_server :
570569 raise RuntimeError ("ServerAsyncStop called without server task active." )
571570 await cls .active_server .shutdown ()
572- if os .name == "nt" :
573- await asyncio .sleep (1 )
574- else :
575- await asyncio .sleep (0 )
576571 cls .active_server = None
577572
578573 @classmethod
@@ -584,11 +579,8 @@ def stop(cls):
584579 if not cls .active_server .loop .is_running ():
585580 Log .info ("ServerStop called with loop stopped." )
586581 return
587- asyncio .run_coroutine_threadsafe (cls .async_stop (), cls .active_server .loop )
588- if os .name == "nt" :
589- time .sleep (10 )
590- else :
591- time .sleep (0.1 )
582+ future = asyncio .run_coroutine_threadsafe (cls .async_stop (), cls .active_server .loop )
583+ future .result (timeout = 10 if os .name == 'nt' else 0.1 )
592584
593585
594586async def StartAsyncTcpServer ( # pylint: disable=invalid-name,dangerous-default-value
You can’t perform that action at this time.
0 commit comments