-
Notifications
You must be signed in to change notification settings - Fork 3k
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
from(AsyncIterable) doesn't finalize async generators #5998
Comments
benlesh
added a commit
to benlesh/rxjs
that referenced
this issue
Feb 26, 2021
- Resolves an issue where AsyncGenerators were not properly finalized when an observable result was unsubscribed. - Resolves another nearly impossible to test scenario that this happens to cover: In the event of an operator like `take()` completing the resulting observable, if an error is thrown in the terminal completion handler, teardown is not invoked, as it would not continue to the next line to call the unsubscribe method of the Subscriber instance. This was resolved by ensuring synchronous calls before the unsubscribe call are called in a try/finally block. Fixes ReactiveX#5998
benlesh
added a commit
to benlesh/rxjs
that referenced
this issue
Feb 26, 2021
- Resolves an issue where AsyncGenerators were not properly finalized when an observable result was unsubscribed. - Resolves another nearly impossible to test scenario that this happens to cover: In the event of an operator like `take()` completing the resulting observable, if an error is thrown in the terminal completion handler, teardown is not invoked, as it would not continue to the next line to call the unsubscribe method of the Subscriber instance. This was resolved by ensuring synchronous calls before the unsubscribe call are called in a try/finally block. Fixes ReactiveX#5998
benlesh
added a commit
that referenced
this issue
Feb 27, 2021
* fix: finalization/teardown fixes for AsyncGenerators and take - Resolves an issue where AsyncGenerators were not properly finalized when an observable result was unsubscribed. - Resolves another nearly impossible to test scenario that this happens to cover: In the event of an operator like `take()` completing the resulting observable, if an error is thrown in the terminal completion handler, teardown is not invoked, as it would not continue to the next line to call the unsubscribe method of the Subscriber instance. This was resolved by ensuring synchronous calls before the unsubscribe call are called in a try/finally block. Fixes #5998 * chore: remove unnecessary try/finally
@benlesh Thank you very much! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Report
Current Behavior
When using
from()
with an async generator, the generator is never finalized.yields:
Expected behavior
I would expect for the async generator to be finalized, just as is done for the non-async generators.
The above code should yield:
Reproduction
https://stackblitz.com/edit/from-async-generator?file=index.ts
Environment
Possible Solution
The
fromAsyncIterable()
function inrxjs/src/internal/observable/from.ts
should handle this case, as doesfromIterable()
.Something along the lines:
The text was updated successfully, but these errors were encountered: