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
@@ -578,10 +577,6 @@ async def async_stop(cls):
578
577
if not cls .active_server :
579
578
raise RuntimeError ("ServerAsyncStop called without server task active." )
580
579
await cls .active_server .server .shutdown ()
581
- if os .name == "nt" :
582
- await asyncio .sleep (1 )
583
- else :
584
- await asyncio .sleep (0 )
585
580
cls .active_server = None
586
581
587
582
@classmethod
@@ -593,11 +588,8 @@ def stop(cls):
593
588
if not cls .active_server .loop .is_running ():
594
589
Log .info ("ServerStop called with loop stopped." )
595
590
return
596
- asyncio .run_coroutine_threadsafe (cls .async_stop (), cls .active_server .loop )
597
- if os .name == "nt" :
598
- time .sleep (10 )
599
- else :
600
- time .sleep (0.1 )
591
+ future = asyncio .run_coroutine_threadsafe (cls .async_stop (), cls .active_server .loop )
592
+ future .result (timeout = 10 if os .name == 'nt' else 0.1 )
601
593
602
594
603
595
async def StartAsyncTcpServer ( # pylint: disable=invalid-name,dangerous-default-value
You can’t perform that action at this time.
0 commit comments