File tree 2 files changed +323
-169
lines changed
packages/cubejs-api-gateway/src
2 files changed +323
-169
lines changed Original file line number Diff line number Diff line change @@ -283,19 +283,23 @@ export class ApiGateway {
283
283
const guestMiddlewares = [ ] ;
284
284
285
285
app . use ( `${ this . basePath } /graphql` , userMiddlewares , ( ( ) => {
286
- let schema ; // memoized schema
286
+ let cache ;
287
287
return ( async ( req , res ) => {
288
- if ( ! schema ) {
288
+ if ( ! cache ) {
289
289
const metaConfig = await this . getCompilerApi ( req . context ) . metaConfig ( {
290
290
requestId : req . context . requestId ,
291
291
} ) ;
292
- schema = makeSchema ( metaConfig ) ;
292
+ cache = {
293
+ metaConfig,
294
+ schema : makeSchema ( metaConfig )
295
+ } ;
293
296
}
294
297
295
298
return graphqlHTTP ( {
296
- schema,
299
+ schema : cache . schema ,
297
300
context : {
298
301
req,
302
+ metaConfig : cache . metaConfig ,
299
303
apiGateway : this
300
304
} ,
301
305
graphiql : getEnv ( 'nodeEnv' ) !== 'production'
You can’t perform that action at this time.
0 commit comments