File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -498,7 +498,9 @@ def __await__(self):
498498 return self .start ().__await__ ()
499499
500500 async def cancel_start (self ):
501- self .__startup_task .cancel ()
501+ if self .__startup_task :
502+ self .__startup_task .cancel ()
503+ await self .started ()
502504
503505 async def start_unsafe (self ):
504506 """Attempt to start the server. This is not idempotent and not protected against concurrent startup attempts.
Original file line number Diff line number Diff line change @@ -584,7 +584,6 @@ async def close(
584584 # status to closing
585585 logger .info ("Closing Nanny at %r. Reason: %s" , self .address_safe , reason )
586586 await self .cancel_start ()
587- await self .started ()
588587
589588 self .status = Status .closing
590589
Original file line number Diff line number Diff line change @@ -1519,7 +1519,6 @@ async def close( # type: ignore
15191519 # Make sure we're not colliding with the startup coro when setting the
15201520 # status to closing
15211521 await self .cancel_start ()
1522- await self .started ()
15231522 self .status = Status .closing
15241523
15251524 # Stop callbacks before giving up control in any `await`.
You can’t perform that action at this time.
0 commit comments