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