-
Notifications
You must be signed in to change notification settings - Fork 564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closing connections after calling return
on AsyncIterator
returned from watch
#4700
Conversation
Fixing test failure and adding a changelog
32811de
to
3aa56e9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I that console.log
was left in there by accident :)
Co-authored-by: FFranck <franck.franck@mongodb.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 😮
Co-authored-by: Tom Duncalf <tom.duncalf@mongodb.com>
return
on AsyncIntegrator
returned from watch
return
on AsyncIterator
returned from watch
What, How & Why?
This closes an issue, where calling
return
on theAsyncIterator
returned bywatch
wouldn't free up the network connection.The existing code was assuming that
return
would be called on the underlying iterator of a generator function, which is not explicit in the specification. The fix is to get a reference to the response body iterator and explicitly callreturn
on this, while deferring all other implementation to a renamedwatchImpl
method.The syntax involved in unwrapping and rewrapping the iterator is a bit involved, since
watch
must return synchronously while the response body iterator is obtained through a promise.☑️ ToDos
Compatibility
label is updated or copied from previous entrypackage.json
s (if updating internal packages)Breaking
label has been applied or is not necessary