sendEvent puts e on out, bailing if parent cancels first, so a slow or vanished consumer after Ctrl+C can't wedge the stream goroutine on a full buffer.
(parent context.Context, out chan<- Event, e Event)
| 341 | } |
| 342 | defer resp.Body.Close() |
| 343 | |
| 344 | // Idle watchdog: bufio.Scanner.Scan() ignores context, so a server that |
| 345 | // stops sending after 200 OK would wedge readSSE forever. Closing the body |
| 346 | // from the timer unblocks the in-flight Read; readSSE then returns and we |
| 347 | // surface a stall. parent isn't cancelled, so (unlike Ctrl+C) the error |
| 348 | // reaches the user. readSSE resets the timer on every frame. |
| 349 | idle := c.IdleTimeout |
| 350 | if idle <= 0 { |
| 351 | idle = streamIdleTimeout |
| 352 | } |
| 353 | var stalled atomic.Bool |
no outgoing calls