diff options
| author | Dax <[email protected]> | 2026-03-19 18:50:40 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-19 18:50:40 -0400 |
| commit | 63585db6a7f312f900a7aabc29b4ccbbbf34fb21 (patch) | |
| tree | 22427ca532d676116d5f6d6c59dd68eb4a642aa0 | |
| parent | bd44489ada70cf908b69466f623ca74e800b3fc7 (diff) | |
| download | opencode-63585db6a7f312f900a7aabc29b4ccbbbf34fb21.tar.gz opencode-63585db6a7f312f900a7aabc29b4ccbbbf34fb21.zip | |
refactor: replace Bun.sleep with node:timers/promises sleep (#18301)
| -rw-r--r-- | packages/opencode/src/cli/cmd/tui/component/dialog-workspace-list.tsx | 3 | ||||
| -rw-r--r-- | packages/opencode/src/control-plane/workspace.ts | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/packages/opencode/src/cli/cmd/tui/component/dialog-workspace-list.tsx b/packages/opencode/src/cli/cmd/tui/component/dialog-workspace-list.tsx index b11ad6a73..09bb492f6 100644 --- a/packages/opencode/src/cli/cmd/tui/component/dialog-workspace-list.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/dialog-workspace-list.tsx @@ -9,6 +9,7 @@ import { useToast } from "../ui/toast" import { useKeybind } from "../context/keybind" import { DialogSessionList } from "./workspace/dialog-session-list" import { createOpencodeClient } from "@opencode-ai/sdk/v2" +import { setTimeout as sleep } from "node:timers/promises" async function openWorkspace(input: { dialog: ReturnType<typeof useDialog> @@ -56,7 +57,7 @@ async function openWorkspace(input: { return } if (result.response.status >= 500 && result.response.status < 600) { - await Bun.sleep(1000) + await sleep(1000) continue } if (!result.data) { diff --git a/packages/opencode/src/control-plane/workspace.ts b/packages/opencode/src/control-plane/workspace.ts index c3c28ed60..e5294844b 100644 --- a/packages/opencode/src/control-plane/workspace.ts +++ b/packages/opencode/src/control-plane/workspace.ts @@ -1,4 +1,5 @@ import z from "zod" +import { setTimeout as sleep } from "node:timers/promises" import { fn } from "@/util/fn" import { Database, eq } from "@/storage/db" import { Project } from "@/project/project" @@ -117,7 +118,7 @@ export namespace Workspace { const adaptor = await getAdaptor(space.type) const res = await adaptor.fetch(space, "/event", { method: "GET", signal: stop }).catch(() => undefined) if (!res || !res.ok || !res.body) { - await Bun.sleep(1000) + await sleep(1000) continue } await parseSSE(res.body, stop, (event) => { @@ -127,7 +128,7 @@ export namespace Workspace { }) }) // Wait 250ms and retry if SSE connection fails - await Bun.sleep(250) + await sleep(250) } } |
