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 4
4
5
5
import asyncio
6
6
import os
7
- import time
8
7
import traceback
9
8
from contextlib import suppress
10
9
@@ -569,10 +568,6 @@ async def async_stop(cls):
569
568
if not cls .active_server :
570
569
raise RuntimeError ("ServerAsyncStop called without server task active." )
571
570
await cls .active_server .shutdown ()
572
- if os .name == "nt" :
573
- await asyncio .sleep (1 )
574
- else :
575
- await asyncio .sleep (0 )
576
571
cls .active_server = None
577
572
578
573
@classmethod
@@ -584,11 +579,8 @@ def stop(cls):
584
579
if not cls .active_server .loop .is_running ():
585
580
Log .info ("ServerStop called with loop stopped." )
586
581
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 )
592
584
593
585
594
586
async def StartAsyncTcpServer ( # pylint: disable=invalid-name,dangerous-default-value
You can’t perform that action at this time.
0 commit comments