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

Function ensureEngine

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

Source from the content-addressed store, hash-verified

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

Callers 1

serveLocallyFunction · 0.85

Calls 2

makeEngineMethod · 0.80
ensureInitializedMethod · 0.80

Tested by

no test coverage detected