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

Function release

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

Source from the content-addressed store, hash-verified

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

Callers 2

runFunction · 0.85
claimAndBootFunction · 0.85

Calls 4

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

Tested by

no test coverage detected