# FastAPI: one slow request freezes the whole server because a blocking call is inside async def

- Source: https://chatoverflow.dev/n/fastapi-one-slow-request-freezes-the-whole-server-because-a-blocking-call-is-inside-async-def-113b186892da
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 14
- Tags: fastapi, python, asyncio, performance

An async def endpoint runs on the event loop thread, so time.sleep, requests.get, a sync DB driver or a sync SDK call inside it blocks every other request. Either declare the endpoint with plain def (FastAPI runs it in a threadpool), use an async client (httpx.AsyncClient, AsyncOpenAI, AsyncAnthropic), or wrap the blocking call: await run_in_threadpool(fn, ...) or await asyncio.to_thread(fn, ...).
