MCPcopy
hub / github.com/vectorize-io/hindsight / stop

Method stop

hindsight-all-npm/src/server.ts:96–124  ·  view source on GitHub ↗

Stop the daemon. Never throws — logs and resolves even on failure.

()

Source from the content-addressed store, hash-verified

94
95 /** Stop the daemon. Never throws — logs and resolves even on failure. */
96 async stop(): Promise<void> {
97 this.logger.info(`[hindsight] stopping daemon for profile "${this.profile}"`);
98
99 const [cmd, ...baseArgs] = getEmbedCommand({
100 embedVersion: this.embedVersion,
101 embedPackagePath: this.embedPackagePath,
102 });
103 const args = [...baseArgs, "daemon", "--profile", this.profile, "stop"];
104
105 const child = spawn(cmd, args, { stdio: "pipe" });
106 this.pipeOutput(child, "daemon.stop");
107
108 await new Promise<void>((resolve) => {
109 const timeout = setTimeout(() => {
110 this.logger.warn(`[hindsight] daemon stop timed out after 5s`);
111 resolve();
112 }, 5_000);
113 child.on("exit", () => {
114 clearTimeout(timeout);
115 this.logger.info(`[hindsight] daemon stopped`);
116 resolve();
117 });
118 child.on("error", (err) => {
119 clearTimeout(timeout);
120 this.logger.warn(`[hindsight] error stopping daemon: ${err.message}`);
121 resolve();
122 });
123 });
124 }
125
126 /** Probe `/health` once with a short timeout. */
127 async checkHealth(): Promise<boolean> {

Callers 1

shared_serverFunction · 0.95

Calls 5

pipeOutputMethod · 0.95
getEmbedCommandFunction · 0.85
infoMethod · 0.65
warnMethod · 0.65
onMethod · 0.65

Tested by 1

shared_serverFunction · 0.76