MCPcopy Create free account
hub / github.com/ecomfe/tempad-dev / waitForHubStart

Function waitForHubStart

packages/mcp-server/src/cli.ts:131–143  ·  view source on GitHub ↗
(child: ChildProcess)

Source from the content-addressed store, hash-verified

129}
130
131async function waitForHubStart(child: ChildProcess): Promise<Socket> {
132 let foundExistingHub = false
133 child.once('exit', (code) => {
134 foundExistingHub = code === HUB_BUSY_EXIT_CODE
135 })
136
137 const socket = await connectWithRetry(HUB_STARTUP_TIMEOUT)
138 if (foundExistingHub) {
139 log.info('Spawned Hub found an existing lifecycle lock. Using the active Hub.')
140 }
141 child.unref()
142 return socket
143}
144
145async function tryBecomeLeaderAndStartHub(): Promise<Socket> {
146 let releaseLock: (() => Promise<void>) | undefined

Callers 1

Calls 1

connectWithRetryFunction · 0.85

Tested by

no test coverage detected