-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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 cleanup observer blocking unsubscribe (2) (#6985) #7170
Fix cleanup observer blocking unsubscribe (2) (#6985) #7170
Conversation
@javier-garcia-meteologica: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/ |
6dffbc1
to
2960a3e
Compare
This is great! Really waiting for this to get merged. We noticed another issue we are investigating now, seems like it's related to GraphQL |
The test failure in apollographql#7170 was a case of unsubscribing the last observer and then immediately resubscribing another observer, which should keep the subscription alive, for backwards compatibility. Delaying the unsubscribe to a later microtask tick enables this use case, while still unsubscribing very soon after the last non-cleanup Concast observer unsubscribes. In case there are still any cleanup observers in this.observers, and no error or completion has been broadcast yet, we call this.handlers.error to make sure those cleanup observers receive an error that terminates them.
@javier-garcia-meteologica Thanks for adding a test! I was able to fix the test failure by adding a I also noticed that we were not always terminating |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@javier-garcia-meteologica I think this is close, but I'd like to see if we can avoid the changes to MockLink
(see #7170 (comment)). What do you think?
f964ab6
to
ef936ed
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@javier-garcia-meteologica Perfect, thanks!
This patch decrements the
addCount
tally sothis.sub
can be unsubscribed and queries are aborted.Checklist: