fix(js-sdk): return from iterateEvents on end instead of break#1157
Open
fix(js-sdk): return from iterateEvents on end instead of break#1157
Conversation
|
Contributor
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)