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

Method noteFinished

src/mcp/query-pool.ts:536–550  ·  view source on GitHub ↗

A worker has finished `job`: log it when it was slow, or when its caller had stopped waiting.

(job: Job)

Source from the content-addressed store, hash-verified

534
535 /** A worker has finished `job`: log it when it was slow, or when its caller had stopped waiting. */
536 private noteFinished(job: Job): void {
537 const now = Date.now();
538 const started = job.startedAt ?? now;
539 if (job.busyAt !== undefined) {
540 this.log(
541 `${job.toolName} finished after running ${logSecs(now - started)}; its caller had been answered "busy" ` +
542 `${logSecs(now - job.busyAt)} earlier.`,
543 );
544 } else if (!job.settled && now - job.enqueuedAt >= this.slowCallLogMs) {
545 this.log(
546 `Slow call: ${job.toolName} took ${logSecs(now - job.enqueuedAt)} ` +
547 `(waited ${logSecs(started - job.enqueuedAt)} for a worker, ran ${logSecs(now - started)}).`,
548 );
549 }
550 }
551
552 /**
553 * {@link run}, but only when a warm worker is idle right now, so the call

Callers 1

onMessageMethod · 0.95

Calls 1

logSecsFunction · 0.85

Tested by

no test coverage detected