()
| 127 | }; |
| 128 | |
| 129 | const close = () => |
| 130 | Effect.gen(function* () { |
| 131 | const connections = yield* Effect.sync(() => { |
| 132 | const connections = [...idle.values()].map((entry) => entry.connection); |
| 133 | idle.clear(); |
| 134 | return connections; |
| 135 | }); |
| 136 | yield* Effect.forEach(connections, closeQuietly, { |
| 137 | concurrency: "unbounded", |
| 138 | discard: true, |
| 139 | }); |
| 140 | }); |
| 141 | |
| 142 | return { withConnection, close }; |
| 143 | }; |