Repository navigation
fix(apollo): stop the graphql-ws server of the federation driver - #4186
Merged
Merged
Conversation
ApolloFederationDriver creates a GraphQLWsSubscriptionService when subscriptions are enabled, but had no stop() of its own: the base driver only stops the Apollo server. On app.close() the graphql-ws server was never disposed, so open connections dropped with 1006 instead of being closed with 1001, and their onClose and iterator cleanup didn't run. Stop it the way ApolloDriver does.
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
PR Type
What is the current behavior?
ApolloFederationDrivercreates aGraphQLWsSubscriptionServicewhensubscriptionsis set (added in #3682), but it has nostop()override.ApolloBaseDriver.stop()only stops the Apollo server, so onapp.close()the graphql-ws server is never disposed: open subscription connections drop with code 1006 instead of being closed with 1001, and graphql-ws'sonCloseand the subscription iterators'return()cleanup never run.ApolloDriveralready stops it.Issue Number: N/A
What is the new behavior?
ApolloFederationDriver.stop()stops the subscription service, then the Apollo server, asApolloDriverdoes.tests/subscriptions/subscriptions-shutdown.spec.tsopens a graphql-ws connection and closes the app, for both drivers. On master the federation case fails (expected 1006 to be 1001); both pass with the fix.Does this PR introduce a breaking change?