title, date, module, problem_type, severity, symptoms, root_cause, resolution_type, status, confidence, tags, related_patterns
| title |
date |
module |
problem_type |
severity |
symptoms |
root_cause |
resolution_type |
status |
confidence |
tags |
related_patterns |
| DWG 异步任务生命周期清理模式 |
2026-02-15 |
dwg-converter |
workflow_issue |
high |
| activeTasks 持续增长 |
| temp/uploads 原始文件长期残留 |
|
异步任务缺少完成态回收机制(内存与磁盘) |
code_fix |
active |
high |
| memory |
| cleanup |
| async-task |
| dwg |
|
|
现象与影响
DWG 异步转换完成后未清理任务状态和输入文件,服务长期运行后会出现内存与磁盘增长。
修复动作
src/lib/dwg/converter.ts 增加 scheduleTaskCleanup,完成后延迟移除 activeTasks。
- 增加
cleanupInputFile,在成功/失败的 finally 阶段统一删除输入文件。
- 异常兜底分支也执行相同清理逻辑。
验证
npm run type-check -- --pretty false 通过
npm test -- tests/api/auth-me.test.ts --runInBand 通过
预防策略
- 异步任务必须明确“创建 -> 执行 -> 完成 -> 回收”生命周期,避免状态和文件双泄漏。