()
| 6489 | // ------------------------------------------------------------------ |
| 6490 | |
| 6491 | const close = () => |
| 6492 | Effect.gen(function* () { |
| 6493 | for (const runtime of runtimes.values()) { |
| 6494 | if (runtime.plugin.close) { |
| 6495 | yield* runtime.plugin |
| 6496 | .close() |
| 6497 | .pipe( |
| 6498 | Effect.mapError((cause) => pluginStorageFailure(runtime.plugin.id, "close", cause)), |
| 6499 | ); |
| 6500 | } |
| 6501 | } |
| 6502 | if (closeDb) { |
| 6503 | const out = closeDb(); |
| 6504 | if (Effect.isEffect(out)) { |
| 6505 | yield* out; |
| 6506 | } else if (out instanceof Promise) { |
| 6507 | yield* Effect.tryPromise({ |
| 6508 | try: () => out, |
| 6509 | catch: (cause) => |
| 6510 | new StorageError({ |
| 6511 | message: "Executor database close failed", |
| 6512 | cause, |
| 6513 | }), |
| 6514 | }); |
| 6515 | } |
| 6516 | } |
| 6517 | }); |
| 6518 | |
| 6519 | const base = { |
| 6520 | integrations: { |
no test coverage detected