File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ const GraphQL = require("graphql");
1515const { PubSub, withFilter } = require ( "graphql-subscriptions" ) ;
1616const hash = require ( "object-hash" ) ;
1717
18- module . exports = function ( mixinOptions ) {
18+ module . exports = function ( mixinOptions ) {
1919 mixinOptions = _ . defaultsDeep ( mixinOptions , {
2020 routeOptions : {
2121 path : "/graphql" ,
@@ -594,6 +594,16 @@ module.exports = function (mixinOptions) {
594594 return makeExecutableSchema ( schemaDef ) ;
595595 } ,
596596
597+ /**
598+ * Create PubSub instance.
599+ */
600+ createPubSub ( ) {
601+ return new PubSub ( ) ;
602+ } ,
603+
604+ /**
605+ * Prepare GraphQL schemas based on Moleculer services.
606+ */
597607 prepareGraphQLSchema ( ) {
598608 // Schema is up-to-date
599609 if ( ! this . shouldUpdateGraphqlSchema && this . graphqlHandler ) {
@@ -606,7 +616,7 @@ module.exports = function (mixinOptions) {
606616 ) ;
607617
608618 try {
609- this . pubsub = new PubSub ( ) ;
619+ this . pubsub = this . createPubSub ( ) ;
610620 const services = this . broker . registry . getServiceList ( { withActions : true } ) ;
611621 const schema = this . generateGraphQLSchema ( services ) ;
612622
You can’t perform that action at this time.
0 commit comments