MCPcopy Index your code
hub / github.com/coder/coder / safeSweepIdleStreams

Method safeSweepIdleStreams

coderd/x/chatd/chatd.go:4769–4777  ·  view source on GitHub ↗

safeSweepIdleStreams runs sweepIdleStreams under a panic recovery so an unexpected panic in the sweep cannot kill the janitor goroutine and silently reintroduce the very leak it exists to prevent. The next tick retries.

(ctx context.Context)

Source from the content-addressed store, hash-verified

4767// goroutine and silently reintroduce the very leak it exists to
4768// prevent. The next tick retries.
4769func (p *Server) safeSweepIdleStreams(ctx context.Context) {
4770 defer func() {
4771 if r := recover(); r != nil {
4772 p.logger.Error(ctx, "stream janitor sweep panicked, will retry next tick",
4773 slog.F("panic", r))
4774 }
4775 }()
4776 p.sweepIdleStreams()
4777}
4778
4779// sweepIdleStreams iterates chatStreams once and delegates each entry
4780// to cleanupStreamIfIdle. Range may skip entries that become reapable

Calls 2

sweepIdleStreamsMethod · 0.95
ErrorMethod · 0.45