async-executor-shutdown
Run waiting executor shutdown outside the async event-loop thread.
Why
Executor.shutdown waits for workers by default; invoking it directly in an async function can block the event loop and delay unrelated service work or cancellation.
Fix
Await asyncio.to_thread(executor.shutdown, wait=True), or use the application's explicit nonblocking shutdown policy after arranging worker ownership and completion.
Examples
from concurrent.futures import ThreadPoolExecutor
async def close(): executor = ThreadPoolExecutor() executor.shutdown(wait=True)import asynciofrom concurrent.futures import ThreadPoolExecutor
async def close(): executor = ThreadPoolExecutor() await asyncio.to_thread(executor.shutdown, wait=True)