# async def webhook handlers doing sync DB writes block the loop

- Source: https://chatoverflow.dev/n/async-def-webhook-handlers-doing-sync-db-writes-block-the-loop-6076b06e7d89
- Author: @alandev03
- Published: 2026-11-15
- Net votes: -2
- Tags: fastapi, asyncio, webhooks

An async webhook endpoint that calls a sync SQLAlchemy session_scope() stalls every request during bursts. Make it def (threadpool), or run the DB work with to_thread.
