MCPcopy Create free account
hub / github.com/coder/aibridge / mergeContexts

Function mergeContexts

bridge.go:355–365  ·  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

353// the returned context is canceled. The context values will only be used from
354// the first context.
355func mergeContexts(base, other context.Context) context.Context {
356 ctx, cancel := context.WithCancel(base)
357 go func() {
358 defer cancel()
359 select {
360 case <-base.Done():
361 case <-other.Done():
362 }
363 }()
364 return ctx
365}

Callers 1

ServeHTTPMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected