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

fix: finalize behaves well with useDeprecatedSynchronousErrorHandling #6251

Conversation

benlesh
Copy link
Member

@benlesh benlesh commented Apr 22, 2021

Adds tests and ensures a few more scenarios that were hit in Google because they use the deprecated synchronous error handling.

fixes #6250

cc @leggechr

Adds tests and ensures a few more scenarios that were hit in Google because they use the deprecated synchronous error handling.

fixes ReactiveX#6250
Just for readability. The deprecated stuff is a hot mess, and this shows what we get to delete in version 8 more cleanly.
@benlesh benlesh requested a review from cartant April 22, 2021 20:53

subscriber.add(
Copy link
Member Author

Choose a reason for hiding this comment

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

I split this up, and added comments. Just for organizational reasons more than anything.

// properly decorate the subscriber with `__syncError`.
subscriber.add(operator.call(subscriber, this.source));
} else {
try {
Copy link
Member Author

Choose a reason for hiding this comment

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

the primary "fix" is here for the cases where teardown wasn't being called after it was registered if a sync error was thrown.

subscriber.add(callback);
// TODO: This try/finally was only added for `useDeprecatedSynchronousErrorHandling`.
// REMOVE THIS WHEN THAT HOT GARBAGE IS REMOVED IN V8.
try {
Copy link
Member Author

Choose a reason for hiding this comment

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

The "fix" for the finalize issue in the sync case is here. Note that adding a callback to a closed subscriber will cause it to be executed immediately.

Copy link
Collaborator

@cartant cartant left a comment

Choose a reason for hiding this comment

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

🤢

@cartant
Copy link
Collaborator

cartant commented Apr 22, 2021

Do we have tests that are the equivalent of these but are for the normal error handling - not the deprecated synchronous error handling? Seems like something worth testing if we're not already doing that.

@benlesh
Copy link
Member Author

benlesh commented Apr 23, 2021

@cartant I'm unsure. I'll have a look after I merge this.

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.

finalize not firing in super gross mode
2 participants