[Bugfix] Clean up async client sockets after event loop closure (#57757)

Signed-off-by: Taneem Ibrahim <taneem.ibrahim@gmail.com>
This commit is contained in:
Taneem Ibrahim
2026-10-09 10:32:47 -04:00
committed by GitHub
parent fc39317392
commit a6b39f0262
+2 -2
View File
@@ -538,10 +538,10 @@ class BackgroundResources:
with contextlib.suppress(Exception):
task.cancel()
if loop is not None:
if loop is not None and not loop.is_closed():
if in_loop(loop):
close_sockets_and_tasks()
elif not loop.is_closed():
else:
loop.call_soon_threadsafe(close_sockets_and_tasks)
else:
# Loop has been closed, try to clean up directly.