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

Function mergeContexts

aibridge/bridge.go:430–440  ·  view source on GitHub ↗

mergeContexts merges two contexts together, so that if either is canceled the returned context is canceled. The context values will only be used from the first context.

(base, other context.Context)

Source from the content-addressed store, hash-verified

428// the returned context is canceled. The context values will only be used from
429// the first context.
430func mergeContexts(base, other context.Context) context.Context {
431 ctx, cancel := context.WithCancel(base)
432 go func() {
433 defer cancel()
434 select {
435 case <-base.Done():
436 case <-other.Done():
437 }
438 }()
439 return ctx
440}

Callers 1

ServeHTTPMethod · 0.85

Calls 1

DoneMethod · 0.45

Tested by

no test coverage detected