Skip to content
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

[gh-10902] Remove the logic for emit close, autodestroy will emit clo… #10906

Merged
merged 1 commit into from
Oct 21, 2021

Conversation

iovanom
Copy link
Contributor

@iovanom iovanom commented Oct 20, 2021

…se. Works only for node>=12.

Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. The two fields below are mandatory.

If you're making a change to documentation, do not modify a .html file directly. Instead find the corresponding .pug file or test case in the test/docs directory.

Summary
The query/aggregate cursor should emit 'end' event and the 'end' event should be emitted before 'close' event.
It can be fixed using the auto destroy feature that exists in node >= 12.
I've added the autoDestroy=true for stream options because for node 12 this option is false by default.
This fix will work for node >= 12.

Examples

@iovanom iovanom mentioned this pull request Oct 20, 2021
@IslandRhythms IslandRhythms linked an issue Oct 20, 2021 that may be closed by this pull request
@simllll
Copy link
Contributor

simllll commented Oct 20, 2021

LGTM :-)

Copy link
Collaborator

@vkarpov15 vkarpov15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for finding this issue!

For future reference, here's the relevant docs on autoDestroy changing to true on Node v14: https://nodejs.org/api/stream.html#new-streamreadableoptions . autoDestroy is supported on all node versions >= 12.0.0, so we should be fine.

@vkarpov15 vkarpov15 added this to the 6.0.12 milestone Oct 21, 2021
@vkarpov15 vkarpov15 merged commit a2f626b into Automattic:master Oct 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cursor never finishes
3 participants