Add Comments

This commit is contained in:
马一丁
2025-11-15 02:54:29 +08:00
parent 5ef63ece78
commit 5e1fbc97cc
4 changed files with 35 additions and 0 deletions
+7
View File
@@ -634,6 +634,13 @@ def stream_task(task_id: str):
last_event_id = None
def event_generator():
"""
SSE事件生成器。
- 负责注册并消费对应任务的事件队列;
- 先回放历史事件再持续监听实时事件;
- 周期性发送心跳并在任务结束后自动注销监听。
"""
queue = _register_stream(task_id)
try:
# 断线重连场景下,先补发历史事件,保证界面状态一致