fix(js-sdk): return from iterateEvents on end instead of break#1157
fix(js-sdk): return from iterateEvents on end instead of break#1157
Conversation
|
Package ArtifactsBuilt from 128f096. Download artifacts from this workflow run. JS SDK ( npm install ./e2b-2.13.1-fix-iterate-events-return.0.tgzCLI ( npm install ./e2b-cli-2.7.2-fix-iterate-events-return.0.tgzPython SDK ( pip install ./e2b-2.14.0+fix.iterate.events.return-py3-none-any.whl |
63e5ab4 to
0930167
Compare
On receiving the "end" event in iterateEvents(), call handleDisconnect() to abort the transport controller, then return from the generator to stop blocking on the stream. In handleEvents(), ignore iteration errors when a result has already been captured since the error is from the expected abort. After the generator exits, fire a .next() call on the events stream to trigger connectrpc's deadline timer cleanup — on platforms where abort propagates to the body reader (Deno) this clears the timer immediately; on Node.js (nodejs/undici#1940) it settles when the server closes the stream.
0930167 to
6815c8f
Compare
|
I would need a test case here to be able to compare current/breaking vs proposed version |
Summary
breakwithreturnin the"end"case ofCommandHandle.iterateEvents()so the async generator exits immediately once the command result is captured, instead of continuing to wait for the transport-level gRPC stream to close.Test plan
pnpm run typecheckpassespnpm run lintpassespnpm run formatpasses (no changes)