mirror of
https://gitee.com/zhangsken/opencode.git
synced 2026-10-16 10:30:01 +08:00
fix(provider): handle SSE reader cancel rejections (#44944)
This commit is contained in:
@@ -35,7 +35,7 @@ function wrapSSE(res: Response, ms: number, ctl: AbortController) {
|
||||
const id = setTimeout(() => {
|
||||
const err = new Error("SSE read timed out")
|
||||
ctl.abort(err)
|
||||
void reader.cancel(err)
|
||||
reader.cancel(err).catch(() => {})
|
||||
reject(err)
|
||||
}, ms)
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ function wrapSSE(res: Response, ms: number, ctl: AbortController) {
|
||||
const id = setTimeout(() => {
|
||||
const err = new ProviderError.ResponseStreamError("SSE read timed out")
|
||||
ctl.abort(err)
|
||||
void reader.cancel(err)
|
||||
reader.cancel(err).catch(() => {})
|
||||
reject(err)
|
||||
}, ms)
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ describe("v2 pty HttpApi", () => {
|
||||
expect(body.data.title).toBe("v2")
|
||||
|
||||
// The canonical surface keeps exited sessions observable with their exit code.
|
||||
const deadline = Date.now() + 5_000
|
||||
const deadline = Date.now() + 20_000
|
||||
let info: { status: string; exitCode?: number } | undefined
|
||||
while (Date.now() < deadline) {
|
||||
const found = await request(`/api/pty/${body.data.id}`, tmp.path)
|
||||
|
||||
Reference in New Issue
Block a user