Skip to content

Commit

Permalink
fix defaultTracer not exported from server/apollo.js
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandra-c committed Feb 27, 2023
1 parent c4e8fc9 commit 2a54e01
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions generators/app/templates/infrastructure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"@totalsoft/messaging-host": "^2.4.2",
<%_}_%>
"async-mutex": "^0.4.0",
"bluebird": "^3.7.2",
"colors": "^1.4.0",
"console-stamp": "^3.1.1",
"dotenv": "16.0.1",
Expand Down
7 changes: 2 additions & 5 deletions generators/app/templates/infrastructure/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const httpServer = createServer();
<%_ if(addSubscriptions){ _%>
const subscriptionServer = startSubscriptionServer(httpServer);
<%_}_%>
const apolloServer = startApolloServer(httpServer<% if(addSubscriptions) {%>, subscriptionServer<%}%>)
const { cleanup: cleanupApolloServer } = startApolloServer(httpServer<% if(addSubscriptions) {%>, subscriptionServer<%}%>)
<%_ if(addMessaging) {_%>
const msgHost = startMsgHost();
<%_}_%>
Expand All @@ -56,10 +56,7 @@ async function cleanup() {
<%_ if(addMessaging) {_%>
await msgHost?.stop();
<%_}_%>
await (await apolloServer)?.stop();
<%_ if(addTracing) {_%>
defaultTracer?.close();
<%_}_%>
await cleanupApolloServer()
}

const { gracefulShutdown } = require('@totalsoft/graceful-shutdown');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,14 @@ const startApolloServer = async (httpServer<% if(addSubscriptions) {%>, subscrip

httpServer.on('request', app.callback())

return apolloServer
const cleanup = async () => {
await (await apolloServer)?.stop()
<%_ if(addTracing) {_%>
defaultTracer?.close();
<%_}_%>
}

return { apolloServer, cleanup }
};

module.exports = { startApolloServer, plugins };

0 comments on commit 2a54e01

Please sign in to comment.