|
|
@@ -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)
|
|
|
}
|
|
|
}
|
|
|
|