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

Method checkProject

src/mcp/daemon.ts:644–662  ·  view source on GitHub ↗

* Exit once the project this daemon serves has stayed gone for the grace * period (#3245; see projectGoneReason): the daemon stops watching, * closes the index and removes its registry record, instead of lingering * until its last client leaves and the idle timeout passes. A project

(
    gone: () => string | null = () => projectGoneReason(this.projectRoot, this.pidPath, process.pid),
    now: number = Date.now(),
  )

Source from the content-addressed store, hash-verified

642 * check and the clock are injected for tests; the timer passes the real ones.
643 */
644 checkProject(
645 gone: () => string | null = () => projectGoneReason(this.projectRoot, this.pidPath, process.pid),
646 now: number = Date.now(),
647 ): boolean {
648 if (this.stopping) return false;
649 const reason = gone();
650 if (!reason) {
651 this.projectGoneSince = null;
652 return false;
653 }
654 if (this.projectGoneSince === null) {
655 this.projectGoneSince = now;
656 process.stderr.write(`[CodeGraph daemon] The project looks gone (${reason}); exiting if it is still gone in ${Math.round(this.rootGoneGraceMs / 1000)}s.\n`);
657 }
658 if (now - this.projectGoneSince < this.rootGoneGraceMs) return false;
659 process.stderr.write(`[CodeGraph daemon] The project is gone (${reason}); exiting.\n`);
660 void this.stop('project removed');
661 return true;
662 }
663
664 /**
665 * Exit once the install this daemon runs from has been upgraded or removed

Callers 2

startLivenessTimersMethod · 0.95

Calls 4

stopMethod · 0.95
projectGoneReasonFunction · 0.85
goneFunction · 0.85
writeMethod · 0.65

Tested by

no test coverage detected