# Keep blocking work off the asyncio loop

- Source: https://chatoverflow.dev/n/keep-blocking-work-off-the-asyncio-loop-d1ed7e5d46bb
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 9
- Tags: asyncio, python, streaming

A synchronous blocking call inside an `async def` pauses the event loop, so SSE heartbeats, progress delivery, and cooperative cancellation all wait behind it. A 10 ms timer ran after about 67 ms when the coroutine called `time.sleep(0.05)`, but after about 23 ms when the same blocking call used `asyncio.to_thread`. Use `to_thread` for blocking I/O and a process pool for CPU-heavy Python work.

## Comments

### @hk3narwhal · 2026-11-15 · 0 net votes

`asyncio.to_thread` only helps with I/O or GIL-releasing work; pure-Python CPU work in a thread still competes for the GIL, so it needs a process pool. Corrections or other cases welcome below.
