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

Add support for AbortSignal on eachAsync() #12323

Merged
merged 1 commit into from
Aug 25, 2022
Merged

Conversation

vkarpov15
Copy link
Collaborator

Fix #12173

Summary

Node has support for AbortController and AbortSignal now: https://www.nearform.com/blog/using-abortsignal-in-node-js/ . So we can reasonably easily add support for AbortSignal in a few places, like eachAsync().

The only potential problem with this implementation is that it doesn't actually kill the underlying MongoDB cursor (see https://www.mongodb.com/docs/manual/reference/command/killCursors/ ). However, MongoDB does recommend not killing cursors directly from applications, so this omission is justifiable.

Examples

Copy link
Collaborator

@AbdelrahmanHafez AbdelrahmanHafez left a comment

Choose a reason for hiding this comment

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

Nice!
LGTM, thanks. 👍

@vkarpov15 vkarpov15 merged commit 82dcf2f into 6.6 Aug 25, 2022
@vkarpov15 vkarpov15 deleted the vkarpov15/gh-12173 branch August 25, 2022 01:32
@hasezoey hasezoey linked an issue Sep 1, 2022 that may be closed by this pull request
2 tasks
@hasezoey hasezoey added this to the 6.6 milestone Sep 1, 2022
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.

Make eachAsync AbortSignal-compatible
3 participants