feat: improve task cancellation and error logging in DomainFronter

This commit is contained in:
Abolfazl
2026-05-03 06:49:15 +03:30
parent 9f8c28a309
commit 3079b83181
2 changed files with 36 additions and 11 deletions
+6
View File
@@ -310,6 +310,12 @@ async def _run(config):
await server.start()
finally:
await server.stop()
# Cancel any tasks that leaked through (e.g. fire-and-forget pool tasks).
stray = [t for t in asyncio.all_tasks() if t is not asyncio.current_task()]
for t in stray:
t.cancel()
if stray:
await asyncio.gather(*stray, return_exceptions=True)
if __name__ == "__main__":