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

Function closeServerHandlers

apps/local/src/main.ts:52–68  ·  view source on GitHub ↗
(handlers: ServerHandlers)

Source from the content-addressed store, hash-verified

50 }).pipe(Effect.ignore);
51
52const closeServerHandlers = async (handlers: ServerHandlers): Promise<void> => {
53 await Effect.runPromise(
54 Effect.gen(function* () {
55 yield* Effect.all(
56 [
57 ignoreDisposeFailure("api.dispose", () => handlers.api.dispose()),
58 ignoreDisposeFailure("mcp.close", () => handlers.mcp.close()),
59 ],
60 { concurrency: "unbounded" },
61 );
62 // The API/MCP handlers borrow the shared local executor handle. Release it
63 // after the surfaces are closed so server shutdown (and failed startup
64 // cleanup via disposeServerHandlers) releases the owned data-dir lock.
65 yield* ignoreDisposeFailure("disposeExecutor", () => disposeExecutor());
66 }),
67 );
68};
69
70export const createServerHandlers = async (token: string): Promise<ServerHandlers> => {
71 let apiHandler: ServerHandlers["api"] | null = null;

Callers 1

getServerHandlersRuntimeFunction · 0.85

Calls 4

disposeExecutorFunction · 0.90
ignoreDisposeFailureFunction · 0.85
disposeMethod · 0.80
closeMethod · 0.65

Tested by

no test coverage detected