Replace Instance.disposeAll/load with fixture helper (#25418)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { AppRuntime } from "@/effect/app-runtime"
|
||||
import { Instance } from "../project/instance"
|
||||
import { InstanceStore } from "../project/instance-store"
|
||||
|
||||
export async function bootstrap<T>(directory: string, cb: () => Promise<T>) {
|
||||
return Instance.provide({
|
||||
@@ -9,7 +9,7 @@ export async function bootstrap<T>(directory: string, cb: () => Promise<T>) {
|
||||
const result = await cb()
|
||||
return result
|
||||
} finally {
|
||||
await Instance.dispose()
|
||||
await InstanceStore.runtime.runPromise((s) => s.dispose(Instance.current))
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Installation } from "@/installation"
|
||||
import { Server } from "@/server/server"
|
||||
import * as Log from "@opencode-ai/core/util/log"
|
||||
import { Instance } from "@/project/instance"
|
||||
import { InstanceStore } from "@/project/instance-store"
|
||||
import { Rpc } from "@/util/rpc"
|
||||
import { upgrade } from "@/cli/upgrade"
|
||||
import { Config } from "@/config/config"
|
||||
@@ -87,7 +88,7 @@ export const rpc = {
|
||||
async shutdown() {
|
||||
Log.Default.info("worker shutting down")
|
||||
|
||||
await Instance.disposeAll()
|
||||
await InstanceStore.runtime.runPromise((s) => s.disposeAll())
|
||||
if (server) await server.stop(true)
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user