-
Notifications
You must be signed in to change notification settings - Fork 12
feat(infra): SSE 心跳 + 超时保护 #263
Copy link
Copy link
Closed
Labels
P1Priority 1 - ImportantPriority 1 - ImportantbackendBackend/API related workBackend/API related workinfraInfrastructure and platform operationsInfrastructure and platform operationsphase-3Roadmap phase 3Roadmap phase 3
Description
Metadata
Metadata
Assignees
Labels
P1Priority 1 - ImportantPriority 1 - ImportantbackendBackend/API related workBackend/API related workinfraInfrastructure and platform operationsInfrastructure and platform operationsphase-3Roadmap phase 3Roadmap phase 3
关联 Epic
Closes part of #245
问题描述
除
studio_chat.py:517有 15s keepalive 外,其他 SSE 端点无心跳机制。长时间运行的 paper analysis 或 code generation 过程中,nginx/cloudflare 可能因空闲超时断连。此外
wrap_generator(streaming.py:151-171)中:asyncio.CancelledError(Python 3.8+ 是 BaseException)finally块确保 generator 关闭X-Accel-Buffering: noheader修复方案
wrap_generator中添加周期性:comment\n\n心跳(SSE 标准注释行,每 15s)asyncio.timeout()包装,默认 30 分钟可配置asyncio.CancelledError并在finally中aclose()generatorX-Accel-Buffering: noheader验收标准