MCPcopy Index your code
hub / github.com/codehamr/codehamr / sendEvent

Function sendEvent

internal/llm/llm.go:343–350  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 4

runMethod · 0.85
readSSEFunction · 0.85
dispatchDeltaFunction · 0.85

Calls

no outgoing calls

Tested by 1