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

Function ignoreClose

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

Source from the content-addressed store, hash-verified

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

Callers 4

shutdownEngineFunction · 0.70
shutdownExecutorFunction · 0.70
disposeFunction · 0.70
openSessionFunction · 0.70

Calls 2

warnFunction · 0.85
resolveMethod · 0.80

Tested by

no test coverage detected