Skip to content

Commit 0930167

Browse files
committed
fix(js-sdk): stop waiting for stream close after command end event
On receiving the "end" event in iterateEvents(), call handleDisconnect() to abort the transport controller, then let the abort error propagate through the for-await loop. This allows connectrpc's runStreamingCall to reach its finally block and clear the deadline timer, avoiding resource leaks in Deno. In handleEvents(), ignore iteration errors when a result has already been captured since the error is the expected abort from disconnect.
1 parent dc77742 commit 0930167

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/js-sdk/src/sandbox/commands/commandHandle.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ export class CommandHandle
216216
stdout: this.stdout,
217217
stderr: this.stderr,
218218
}
219+
this.handleDisconnect()
219220
break
220221
}
221222
// TODO: Handle empty events like in python SDK
@@ -234,7 +235,9 @@ export class CommandHandle
234235
}
235236
}
236237
} catch (e) {
237-
this.iterationError = handleRpcError(e)
238+
if (!this.result) {
239+
this.iterationError = handleRpcError(e)
240+
}
238241
}
239242
}
240243
}

0 commit comments

Comments
 (0)