Skip to content

Commit

Permalink
stop previous apolloServer before creating a new one
Browse files Browse the repository at this point in the history
This causes socket listeners to close gracefully.
Fixes issues moleculerjs#51 and moleculerjs#74
  • Loading branch information
arash16 committed Mar 8, 2021
1 parent 1af1c37 commit c436ec9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/service.js
Expand Up @@ -612,6 +612,10 @@ module.exports = function (mixinOptions) {
if (!this.shouldUpdateGraphqlSchema && this.graphqlHandler) {
return;
}

if (this.apolloServer) {
this.apolloServer.stop();
}

// Create new server & regenerate GraphQL schema
this.logger.info(
Expand Down

0 comments on commit c436ec9

Please sign in to comment.