()
| 5383 | // ------------------------------------------------------------------ |
| 5384 | |
| 5385 | const close = () => |
| 5386 | Effect.gen(function* () { |
| 5387 | for (const runtime of runtimes.values()) { |
| 5388 | if (runtime.plugin.close) { |
| 5389 | yield* runtime.plugin |
| 5390 | .close() |
| 5391 | .pipe( |
| 5392 | Effect.mapError((cause) => pluginStorageFailure(runtime.plugin.id, "close", cause)), |
| 5393 | ); |
| 5394 | } |
| 5395 | } |
| 5396 | if (closeDb) { |
| 5397 | const out = closeDb(); |
| 5398 | if (Effect.isEffect(out)) { |
| 5399 | yield* out; |
| 5400 | } else if (out instanceof Promise) { |
| 5401 | yield* Effect.tryPromise({ |
| 5402 | try: () => out, |
| 5403 | catch: (cause) => |
| 5404 | new StorageError({ |
| 5405 | message: "Executor database close failed", |
| 5406 | cause, |
| 5407 | }), |
| 5408 | }); |
| 5409 | } |
| 5410 | } |
| 5411 | }); |
| 5412 | |
| 5413 | const base = { |
| 5414 | integrations: { |
no test coverage detected