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

Function release

packages/plugins/mcp/src/sdk/connection-pool.ts:86–99  ·  view source on GitHub ↗
(key: string, lease: ConnectionLease, exit: Exit.Exit<A, E>)

Source from the content-addressed store, hash-verified

84 });
85
86 const release = <A, E>(key: string, lease: ConnectionLease, exit: Exit.Exit<A, E>) =>
87 Effect.gen(function* () {
88 if (shouldDropConnection(exit)) {
89 yield* closeQuietly(lease.connection);
90 return;
91 }
92
93 const displaced = yield* Effect.sync(() => {
94 if (idle.has(key)) return lease.connection;
95 idle.set(key, { connection: lease.connection, idleSince: Date.now() });
96 return undefined;
97 });
98 if (displaced) yield* closeQuietly(displaced);
99 });
100
101 const withConnection: McpConnectionPool["withConnection"] = (key, connector, use) => {
102 let reused = false;

Callers 3

makeBarrierStoreFunction · 0.85
runFunction · 0.85
claimAndBootFunction · 0.85

Calls 4

shouldDropConnectionFunction · 0.85
setMethod · 0.80
closeQuietlyFunction · 0.70
syncMethod · 0.65

Tested by 1

makeBarrierStoreFunction · 0.68