style(backend): 精简 P1-1 期间的说明性注释
代码只留一行不变量。进程分工的动机、退避与重连的细节、测试可验证性的理由,都已在 docs/solutions/P1-1-async-workers-out-of-api.md 里写过,注释不再复述。 保留的是读代码看不出来的约束:超时派生自 poller 的 ctx、坏消息不能打断订阅、SSE 响应永不结束、订阅存活够久要重置退避。 文档补一句退避重置规则。这是删掉的注释里唯一没有落在文档上的细节。 验证:go test -count=1 ./... 全绿。
This commit is contained in:
@@ -138,8 +138,7 @@ func main() {
|
||||
stop()
|
||||
|
||||
log.Printf("API shutting down...")
|
||||
// SSE 长连接由 SSEHub 在 ctx 取消时主动断开,所以这里等的是普通在途请求。
|
||||
// 超时后 Close 兜底:不能因为个别连接不返回就永远不退出。
|
||||
// SSE 连接已随 ctx 断开,这里等的是普通在途请求;超时则 Close 兜底。
|
||||
shutdownCtx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
if err := srv.Shutdown(shutdownCtx); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user