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