fix(sse): disable read deadline for long-lived connections #56

Merged
forbes merged 1 commits from fix-sse-read-deadline into main 2026-02-09 17:39:09 +00:00
Owner

The server's ReadTimeout (15s) was closing SSE connections shortly after they were established, causing a rapid connect/disconnect loop:

SSE reconnecting (1/10): connection closed
SSE connected
SSE reconnecting (2/10): connection closed
SSE connected
...

The handler already disabled WriteTimeout via SetWriteDeadline(time.Time{}) but did not disable ReadTimeout. Once the read deadline fired, Go's HTTP server closed the underlying connection.

Fix: Also call rc.SetReadDeadline(time.Time{}) to keep the connection alive indefinitely.

The server's `ReadTimeout` (15s) was closing SSE connections shortly after they were established, causing a rapid connect/disconnect loop: ``` SSE reconnecting (1/10): connection closed SSE connected SSE reconnecting (2/10): connection closed SSE connected ... ``` The handler already disabled `WriteTimeout` via `SetWriteDeadline(time.Time{})` but did not disable `ReadTimeout`. Once the read deadline fired, Go's HTTP server closed the underlying connection. **Fix:** Also call `rc.SetReadDeadline(time.Time{})` to keep the connection alive indefinitely.
forbes added 1 commit 2026-02-09 04:52:53 +00:00
The server's ReadTimeout (15s) was closing SSE connections shortly after
they were established, causing a rapid connect/disconnect loop. The handler
already disabled WriteTimeout but not ReadTimeout.
forbes merged commit 701a5c21ce into main 2026-02-09 17:39:09 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/silo#56