()
| 4050 | // ------------------------------------------------------------------ |
| 4051 | |
| 4052 | const close = () => |
| 4053 | Effect.gen(function* () { |
| 4054 | for (const runtime of runtimes.values()) { |
| 4055 | if (runtime.plugin.close) { |
| 4056 | yield* runtime.plugin |
| 4057 | .close() |
| 4058 | .pipe( |
| 4059 | Effect.mapError((cause) => pluginStorageFailure(runtime.plugin.id, "close", cause)), |
| 4060 | ); |
| 4061 | } |
| 4062 | } |
| 4063 | if (closeDb) { |
| 4064 | const out = closeDb(); |
| 4065 | if (Effect.isEffect(out)) { |
| 4066 | yield* out; |
| 4067 | } else if (out instanceof Promise) { |
| 4068 | yield* Effect.tryPromise({ |
| 4069 | try: () => out, |
| 4070 | catch: (cause) => |
| 4071 | new StorageError({ |
| 4072 | message: "Executor database close failed", |
| 4073 | cause, |
| 4074 | }), |
| 4075 | }); |
| 4076 | } |
| 4077 | } |
| 4078 | }); |
| 4079 | |
| 4080 | const base = { |
| 4081 | integrations: { |
no test coverage detected