fix(world): events stream survives past the server WriteTimeout
The global 60s WriteTimeout (cmd/world) severed the long-lived ?stream=1 NDJSON response every cycle — the world-gw ingester logged "unexpected EOF" and reconnected in a loop. Clear the per-request write/read deadlines via http.NewResponseController for the stream response ONLY; every other handler keeps the global timeout.
This commit is contained in:
@@ -473,6 +473,13 @@ func (s *Server) streamEvents(w http.ResponseWriter, r *http.Request, q eventQue
|
||||
writeError(w, http.StatusInternalServerError, "streaming unsupported")
|
||||
return
|
||||
}
|
||||
// The server's global WriteTimeout (60s, cmd/world) would sever this long-lived
|
||||
// stream mid-flight (the gw ingester saw "unexpected EOF" every cycle and had to
|
||||
// reconnect). Clear the per-request deadlines for THIS response only — every other
|
||||
// handler keeps the global timeout.
|
||||
rc := http.NewResponseController(w)
|
||||
_ = rc.SetWriteDeadline(time.Time{})
|
||||
_ = rc.SetReadDeadline(time.Time{})
|
||||
h := w.Header()
|
||||
h.Set("Content-Type", "application/x-ndjson")
|
||||
h.Set("Cache-Control", "no-store")
|
||||
|
||||
Reference in New Issue
Block a user