chore: 导入旧记忆备份供恢复
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
---
|
||||
title: 坑:FastAPI async def 里阻塞 I/O 冻结事件循环
|
||||
type: experience
|
||||
permalink: main/projects/d5a7f581-c442-4554-87b9-ee723b8b0258/坑-fast-api-async-def-里阻塞-i-o-冻结事件循环
|
||||
stable_id: df065dbf-85de-4f2b-bbb1-5d8b115de08c
|
||||
scope: project
|
||||
memory_type: experience
|
||||
project_id: d5a7f581-c442-4554-87b9-ee723b8b0258
|
||||
usage_profile_id: 7aee455b-24cc-4008-bdaf-443721e6f939
|
||||
status: active
|
||||
revision: 1
|
||||
request_id: metrix-mig-e3
|
||||
created_at: '2026-08-12T17:38:25.884966+00:00'
|
||||
updated_at: '2026-08-12T17:38:25.884966+00:00'
|
||||
tags:
|
||||
- pitfall
|
||||
- fastapi
|
||||
- async
|
||||
---
|
||||
|
||||
CapacityReport 大表导出把 /health 都卡死:async def 处理函数里直接调 pymysql/大文件/轮询等阻塞 I/O,事件循环被占满。修复:把这类处理函数改成普通 def,FastAPI 自动扔进线程池。通用经验:同步库(pymysql、paramiko、requests)的调用链不要包在 async def 接口里;另外重建线程池时旧池用 shutdown(wait=False) 非阻塞关闭(database/jobs.py、scripts/runs.py 的 _pool 模式)。
|
||||
Reference in New Issue
Block a user