-
Notifications
You must be signed in to change notification settings - Fork 4
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
Support return() #22
Comments
Interesting, the only utility I've got that might not consume an iterable in it's entirety is |
If you consume an async iterable like this: https://github.com/bustle/streaming-iterables/blob/master/lib/parallel-map.ts#L28 you never fire "return" on the consumed iterable |
Yeah but eventually it will be consumed. Are you thinking about the error
cases?
…On Wed, Jan 2, 2019, 12:01 PM Maurizio Lupo ***@***.***> wrote:
If you consume an async iterable like this:
https://github.com/bustle/streaming-iterables/blob/master/lib/parallel-map.ts#L28
you never fire "return" on the consumed iterable
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#22 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABlbkiXXvU451AVcctRxmIvylvyKnvQks5u_OYCgaJpZM4Zk8nr>
.
|
The error case is one. |
you can find some extra info here: http://exploringjs.com/es6/ch_iteration.html#_closing-iterators-via-return |
Example:
iterable1, iterable2 and iterable3 are left unfinished and they are never closed. |
If you are not using the "for await of" loop you need to manually call the method return() when the loop is interrupted.
See my notes here:
https://github.com/sithmel/iter-tools/wiki/Generator-functions-work-flow
Also there are plenty of examples in the iter-tools code base.
The text was updated successfully, but these errors were encountered: