Retry initial recovered chat stream attachment failures

This commit is contained in:
2026-11-07 16:43:24 +00:00
parent 62406f7fdb
commit 6699d10eb8
3 changed files with 46 additions and 3 deletions
+8 -3
View File
@@ -991,15 +991,20 @@ func (h *chatHub) drainStream(room *chatRoom, result <-chan error) {
if err != nil && room.ctx.Err() == nil {
log.Printf("chat stream session=%s: %v", room.sessionID, err)
}
// Losing the transport does not end the harness turn. Re-subscribe without
// releasing its queue slot; the harness must report authoritative completion.
h.retryRoomObservation(room, h.roomBroker(room))
}
// retryRoomObservation also covers initial attachment failures, which have no
// drainStream goroutine yet. Keep ownership until authoritative completion.
func (h *chatHub) retryRoomObservation(room *chatRoom, broker chatBroker) {
for room.ctx.Err() == nil {
select {
case <-room.ctx.Done():
return
case <-time.After(time.Second):
}
if err := h.ensureObserving(room, h.roomBroker(room)); err == nil {
if err := h.ensureObserving(room, broker); err == nil {
h.startRoomPoller(room, broker)
return
}
}