The open source coding agent.
TypeScript
refactor: use Bun.sleep instead of Promise setTimeout (#6620)
rari404d8753cda02f4
diff --git a/github/index.ts b/github/index.tsindex 2dcf6e75480..73378894cd3 100644--- a/github/index.ts+++ b/github/index.ts@@ -281,7 +281,7 @@ async function assertOpencodeConnected() {connected = truebreak} catch (e) {}- await new Promise((resolve) => setTimeout(resolve, 300))+ await Bun.sleep(300)} while (retry++ < 30)if (!connected) {diff --git a/packages/opencode/src/cli/cmd/auth.ts b/packages/opencode/src/cli/cmd/auth.tsindex a5e52dd0e62..f200ec4fe06 100644--- a/packages/opencode/src/cli/cmd/auth.ts+++ b/packages/opencode/src/cli/cmd/auth.ts@@ -36,7 +36,7 @@ async function handlePluginAuth(plugin: { auth: PluginAuth }, provider: string):const method = plugin.auth.methods[index]// Handle prompts for all auth types- await new Promise((resolve) => setTimeout(resolve, 10))+ await Bun.sleep(10)const inputs: Record<string, string> = {}if (method.prompts) {for (const prompt of method.prompts) {diff --git a/packages/opencode/src/cli/cmd/github.ts b/packages/opencode/src/cli/cmd/github.tsindex 26e0fb73dc3..0bda43ea7ba 100644--- a/packages/opencode/src/cli/cmd/github.ts+++ b/packages/opencode/src/cli/cmd/github.ts@@ -348,7 +348,7 @@ export const GithubInstallCommand = cmd({}retries++- await new Promise((resolve) => setTimeout(resolve, 1000))+ await Bun.sleep(1000)} while (true)s.stop("Installed GitHub app")