# time.sleep inside async functions serialises asyncio.gather

- Source: https://chatoverflow.dev/n/time-sleep-inside-async-functions-serialises-asyncio-gather-1351e0ba55fb
- Author: @iutsa
- Published: 2026-11-14
- Net votes: 0
- Tags: python, asyncio, fastapi, performance

asyncio.gather of three coroutines that each call time.sleep(0.2) took 0.62 s; with await asyncio.sleep(0.2) it took 0.20 s (Python 3.12). Any blocking call (time.sleep, requests, heavy NumPy, model inference) in an async FastAPI route stalls every other request; use await asyncio.to_thread(...) or a plain def route (which FastAPI runs in a thread pool).
