MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / ignoreClose

Function ignoreClose

packages/hosts/mcp/src/in-memory-session-store.ts:170–190  ·  view source on GitHub ↗
(
  sessionId: string | null,
  handle: string,
  close: (() => Promise<void>) | undefined,
)

Source from the content-addressed store, hash-verified

168 * nothing can see, so name the handle and the session in a warning.
169 */
170const ignoreClose = (
171 sessionId: string | null,
172 handle: string,
173 close: (() => Promise<void>) | undefined,
174): Promise<void> => {
175 if (!close) return Promise.resolve();
176 const warn = (detail: unknown): Effect.Effect<void> =>
177 Effect.sync(() => {
178 console.warn(
179 `[mcp] failed to close ${handle} for session ${sessionId ?? "<uninitialized>"}:`,
180 formatBoundaryError(detail),
181 );
182 });
183 return Effect.runPromise(
184 Effect.tryPromise({ try: close, catch: (cause) => new McpHandleCloseError({ cause }) }).pipe(
185 Effect.catch((error) => warn(error.cause)),
186 // A defect cannot escape either: this runs detached from any request.
187 Effect.catchCause((cause) => warn(Cause.squash(cause))),
188 ),
189 );
190};
191
192// The store's error bodies are INNER responses (no CORS): the serving envelope
193// re-wraps the store `Response` with CORS before it leaves the origin, so the

Callers 3

shutdownEngineFunction · 0.70
disposeFunction · 0.70
openSessionFunction · 0.70

Calls 2

warnFunction · 0.85
resolveMethod · 0.80

Tested by

no test coverage detected