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

Method constructor

src/mcp/query-pool.ts:247–260  ·  view source on GitHub ↗
(opts: QueryPoolOptions)

Source from the content-addressed store, hash-verified

245 private lastServer?: PoolWorker;
246
247 constructor(opts: QueryPoolOptions) {
248 this.root = opts.root;
249 this.maxSize = Math.max(1, Math.min(opts.size ?? Math.max(1, os.cpus().length - 1), MAX_POOL_SIZE));
250 this.softTimeoutMs = opts.softTimeoutMs ?? resolveBusyTimeoutMs();
251 this.maxRetries = opts.maxRetries ?? 1;
252 this.idleShrinkMs = Math.max(0, opts.idleShrinkMs ?? DEFAULT_IDLE_SHRINK_MS);
253 this.idleKeepBytes = opts.idleKeepBytes ?? DEFAULT_IDLE_KEEP_BYTES;
254 this.retireTimeoutMs = opts.retireTimeoutMs ?? RETIRE_TIMEOUT_MS;
255 this.createWorker = opts.createWorker ?? (() => new Worker(WORKER_FILE, { workerData: { root: this.root } }));
256 this.startSettleMs = opts.startSettleMs ?? WORKER_START_SETTLE_MS;
257 this.slowCallLogMs = opts.slowCallLogMs ?? DEFAULT_SLOW_CALL_LOG_MS;
258 this.log = opts.log ?? ((line) => { process.stderr.write(`[CodeGraph MCP] ${line}\n`); });
259 this.spawnOne(); // one eager warm worker, ready for the first call
260 }
261
262 /** Pool size cap (for logging/status). */
263 get size(): number { return this.maxSize; }

Callers

nothing calls this directly

Calls 3

spawnOneMethod · 0.95
resolveBusyTimeoutMsFunction · 0.85
writeMethod · 0.65

Tested by

no test coverage detected