File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -783,19 +783,19 @@ def _make_pool(
783783
784784 return httpcore .AsyncConnectionPool (** opts )
785785
786- def kill (self : Self ) -> None :
786+ def kill (self : Self ) -> Optional [ asyncio . Task [ None ]]: # type: ignore
787787
788788 logger .debug ("Killing HTTP transport" )
789789 self ._worker .kill ()
790790 for task in self .background_tasks :
791791 task .cancel ()
792792 self .background_tasks .clear ()
793793 try :
794- task = self ._loop .create_task (self ._pool .aclose ()) # type: ignore
795- self .background_tasks .add (task )
796- task .add_done_callback (lambda t : self .background_tasks .discard (t ))
794+ # Return the pool cleanup task so caller can await it if needed
795+ return self ._loop .create_task (self ._pool .aclose ()) # type: ignore
797796 except RuntimeError :
798797 logger .warning ("Event loop not running, aborting kill." )
798+ return None
799799
800800
801801class HttpTransport (BaseHttpTransport ):
You can’t perform that action at this time.
0 commit comments