-
-
Notifications
You must be signed in to change notification settings - Fork 163
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
Socket is closed even though there are pending subscriptions #66
Comments
Hmm, are you sure? I reckon this test would be failing then because of the double decrement: graphql-ws/src/tests/client.ts Lines 500 to 537 in 3f4f836
Maybe the test is flawed? 🤔 |
The problems happens with queries and mutations where the server sends the Completed event. What I noticed, at least with Apollo, is that the cleanup function gets invoked almost at the same time which causes the cancellerRef.current to be called twice for the same subscription. |
BTW, this is the cleanup function I'm referring to.
|
Ah, I follow. I was thinking about the canceller cleanup, the one in it haha. Nevertheless, you're right, it can sure happen. I'll head over to your PR. 😄 |
🎉 This issue has been resolved in version 1.13.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I'm using graphql-ws together with Apollo client.
I noticed that for queries and mutations the cancellerRef.current is being invoked twice. Once when the Complete message is received and again from the cleanup function.
As a result state.locks gets decremented twice for the same operation, which causes the socket to be closed even though there are pending operations.
The text was updated successfully, but these errors were encountered: