📝

FastAPI Patterns

2329
0次下载
2次浏览
2026/3/9

- Mixing sync database drivers (psycopg2, PyMySQL) in async endpoints blocks the event loop — use async drivers (asyncpg, aiomysql) or run sync code in `run_in_executor` - `time.sleep()` in async endpoints blocks everything — use `await asyncio.sleep()` instead - CPU-bound work in async endpoints starves other requests — offload to `ProcessPoolExecutor` or background workers - Async endpoints calling sync functions that do I/O still block — the entire call chain must be async

广告位 300x250

资源信息

数据来源
bigquery-gharchive
分类
data-analysis
创建时间
2026/3/9
更新时间
2026/3/14

评论 (0)

登录后发表评论

加载中...