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

Function getServerHandlersRuntime

apps/local/src/main.ts:201–213  ·  view source on GitHub ↗
(
  token: string,
)

Source from the content-addressed store, hash-verified

199 null;
200
201const getServerHandlersRuntime = (
202 token: string,
203): ManagedRuntime.ManagedRuntime<ServerHandlersService, never> => {
204 if (serverHandlersRuntime) return serverHandlersRuntime;
205 const layer = Layer.effect(ServerHandlersService)(
206 Effect.acquireRelease(
207 Effect.promise(() => createServerHandlers(token)),
208 (handlers) => Effect.promise(() => closeServerHandlers(handlers)),
209 ),
210 );
211 serverHandlersRuntime = ManagedRuntime.make(layer);
212 return serverHandlersRuntime;
213};
214
215export const getServerHandlers = (token: string): Promise<ServerHandlers> =>
216 getServerHandlersRuntime(token).runPromise(ServerHandlersService.asEffect());

Callers 1

getServerHandlersFunction · 0.85

Calls 2

createServerHandlersFunction · 0.85
closeServerHandlersFunction · 0.85

Tested by

no test coverage detected