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

Function release

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

Source from the content-addressed store, hash-verified

140 });
141
142 const release = <A, E>(key: string, lease: ConnectionLease, exit: Exit.Exit<A, E>) =>
143 Effect.gen(function* () {
144 if (shouldDropConnection(exit)) {
145 yield* closeQuietly(lease.connection);
146 return;
147 }
148
149 const displaced = yield* Effect.sync(() => {
150 if (idle.has(key)) return lease.connection;
151 idle.set(key, { connection: lease.connection, idleSince: Date.now() });
152 return undefined;
153 });
154 if (displaced) yield* closeQuietly(displaced);
155 });
156
157 const withConnection: McpConnectionPool["withConnection"] = (key, connector, use) => {
158 let reused = false;

Callers 3

runSerializedScopeFunction · 0.85
runFunction · 0.85
claimAndBootFunction · 0.85

Calls 4

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

Tested by

no test coverage detected