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

Method drainInflight

coderd/x/chatd/chatd.go:9887–9891  ·  view source on GitHub ↗

drainInflight waits for all in-flight operations to complete. It acquires inflightMu to prevent processOnce from spawning new goroutines (via inflight.Add) concurrently with Wait, which would violate sync.WaitGroup's contract. https://pkg.go.dev/sync#WaitGroup.Add > Note that calls with a positive

()

Source from the content-addressed store, hash-verified

9885// https://pkg.go.dev/sync#WaitGroup.Add
9886// > Note that calls with a positive delta that occur when the counter is zero must happen before a Wait.
9887func (p *Server) drainInflight() {
9888 p.inflightMu.Lock()
9889 p.inflight.Wait()
9890 p.inflightMu.Unlock()
9891}
9892
9893// refreshExpiredMCPTokens checks each MCP OAuth2 token and refreshes
9894// any that are expired (or about to expire). Tokens without a

Calls 3

WaitMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45