MCPcopy Create free account
hub / github.com/NanmiCoder/MediaCrawler / _cancel_remaining_tasks

Function _cancel_remaining_tasks

tools/app_runner.py:46–59  ·  view source on GitHub ↗
(timeout_seconds: float = 2.0)

Source from the content-addressed store, hash-verified

44 print(f"[Main] Cleanup timeout ({cleanup_timeout_seconds}s), skipping remaining cleanup.")
45
46 async def _cancel_remaining_tasks(timeout_seconds: float = 2.0) -> None:
47 current = asyncio.current_task()
48 tasks = [t for t in asyncio.all_tasks() if t is not current and not t.done()]
49 if not tasks:
50 return
51 for t in tasks:
52 t.cancel()
53 try:
54 await asyncio.wait_for(
55 asyncio.gather(*tasks, return_exceptions=True),
56 timeout=timeout_seconds,
57 )
58 except asyncio.TimeoutError:
59 pass
60
61 async def _runner() -> None:
62 loop = asyncio.get_running_loop()

Callers 1

_runnerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected