File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ async def serve_development_asgi(
3232 started : asyncio .Event | None ,
3333) -> None :
3434 """Run a development server for starlette"""
35+ started = started or asyncio .Event ()
36+
3537 server = UvicornServer (
3638 UvicornConfig (
3739 app ,
@@ -42,15 +44,11 @@ async def serve_development_asgi(
4244 )
4345 )
4446
45- coros : list [Awaitable [Any ]] = [server .serve ()]
46-
47- if started :
48- coros .append (_check_if_started (server , started ))
49-
5047 try :
51- await asyncio .gather (* coros )
48+ await asyncio .gather ([ server . serve (), _check_if_started ( server , started )] )
5249 finally :
53- await asyncio .wait_for (server .shutdown (), timeout = 3 )
50+ if started .is_set ():
51+ await asyncio .wait_for (server .shutdown (), timeout = 3 )
5452
5553
5654async def _check_if_started (server : UvicornServer , started : asyncio .Event ) -> None :
You can’t perform that action at this time.
0 commit comments