Retry initial recovered chat stream attachment failures
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user