()
| 120 | }; |
| 121 | |
| 122 | const close = () => |
| 123 | Effect.gen(function* () { |
| 124 | const connections = yield* Effect.sync(() => { |
| 125 | const connections = [...idle.values()].map((entry) => entry.connection); |
| 126 | idle.clear(); |
| 127 | return connections; |
| 128 | }); |
| 129 | yield* Effect.forEach(connections, closeQuietly, { |
| 130 | concurrency: "unbounded", |
| 131 | discard: true, |
| 132 | }); |
| 133 | }); |
| 134 | |
| 135 | return { withConnection, close }; |
| 136 | }; |