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 @@ -781,19 +781,19 @@ def _make_pool(
781781
782782 return httpcore .AsyncConnectionPool (** opts )
783783
784- def kill (self : Self ) -> None :
784+ def kill (self : Self ) -> Optional [ asyncio . Task [ None ]]: # type: ignore
785785
786786 logger .debug ("Killing HTTP transport" )
787787 self ._worker .kill ()
788788 for task in self .background_tasks :
789789 task .cancel ()
790790 self .background_tasks .clear ()
791791 try :
792- task = self ._loop .create_task (self ._pool .aclose ()) # type: ignore
793- self .background_tasks .add (task )
794- task .add_done_callback (lambda t : self .background_tasks .discard (t ))
792+ # Return the pool cleanup task so caller can await it if needed
793+ return self ._loop .create_task (self ._pool .aclose ()) # type: ignore
795794 except RuntimeError :
796795 logger .warning ("Event loop not running, aborting kill." )
796+ return None
797797
798798
799799class HttpTransport (BaseHttpTransport ):
You can’t perform that action at this time.
0 commit comments