()
| 176 | }; |
| 177 | |
| 178 | const close = () => |
| 179 | Effect.gen(function* () { |
| 180 | const connections = yield* Effect.sync(() => { |
| 181 | const connections = [...idle.values()].map((entry) => entry.connection); |
| 182 | idle.clear(); |
| 183 | return connections; |
| 184 | }); |
| 185 | yield* Effect.forEach(connections, closeQuietly, { |
| 186 | concurrency: "unbounded", |
| 187 | discard: true, |
| 188 | }); |
| 189 | }); |
| 190 | |
| 191 | return { withConnection, close }; |
| 192 | }; |