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(
781
781
782
782
return httpcore .AsyncConnectionPool (** opts )
783
783
784
- def kill (self : Self ) -> None :
784
+ def kill (self : Self ) -> Optional [ asyncio . Task [ None ]]: # type: ignore
785
785
786
786
logger .debug ("Killing HTTP transport" )
787
787
self ._worker .kill ()
788
788
for task in self .background_tasks :
789
789
task .cancel ()
790
790
self .background_tasks .clear ()
791
791
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
795
794
except RuntimeError :
796
795
logger .warning ("Event loop not running, aborting kill." )
796
+ return None
797
797
798
798
799
799
class HttpTransport (BaseHttpTransport ):
You can’t perform that action at this time.
0 commit comments