MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / ensureEngine

Function ensureEngine

src/mcp/proxy.ts:356–366  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

354 // Resolves the engine a call was started on, so a call in flight while the
355 // engine is being retired still finishes on it.
356 const ensureEngine = async (): Promise<MCPEngine> => {
357 // shutdown() stops only the engines it can see; never start one after it.
358 if (!engine && shuttingDown) throw new Error('codegraph is shutting down');
359 if (!engine) {
360 engine = deps.makeEngine();
361 engineReady = engine.ensureInitialized(deps.root).catch(() => { /* degraded */ });
362 }
363 const current = engine;
364 await engineReady;
365 return current;
366 };
367 // Stop the in-process engine once the calls it is serving have answered.
368 // Stopping it releases the writer lock if it held one.
369 const retireEngine = async (): Promise<void> => {

Callers 1

serveLocallyFunction · 0.85

Calls 2

makeEngineMethod · 0.80
ensureInitializedMethod · 0.80

Tested by

no test coverage detected