MCPcopy Create free account
hub / github.com/PostHog/duckgres / WaitAll

Method WaitAll

server/parent.go:108–126  ·  view source on GitHub ↗

WaitAll returns a channel that is closed when all children have exited. Caller should call this after SignalAll to wait for graceful shutdown. NOTE: This method creates a new goroutine each time it's called. It captures a snapshot of current children at call time - children added after the call won

()

Source from the content-addressed store, hash-verified

106// a snapshot of current children at call time - children added after the call
107// won't be waited on. For typical shutdown scenarios, call this once after SignalAll.
108func (ct *ChildTracker) WaitAll() <-chan struct{} {
109 done := make(chan struct{})
110
111 go func() {
112 ct.mu.RLock()
113 children := make([]*ChildProcess, 0, len(ct.children))
114 for _, child := range ct.children {
115 children = append(children, child)
116 }
117 ct.mu.RUnlock()
118
119 for _, child := range children {
120 <-child.done // Wait for each child to exit
121 }
122 close(done)
123 }()
124
125 return done
126}
127
128// spawnChildForTLS spawns a child worker process to handle TLS handshake and the rest of the connection.
129// This is called after the parent has received an SSL request and sent 'S'.

Callers 3

TestChildTrackerWaitAllFunction · 0.95
CloseMethod · 0.80
ShutdownMethod · 0.80

Calls

no outgoing calls

Tested by 1

TestChildTrackerWaitAllFunction · 0.76