Skip to content

Commit

Permalink
fix: explicitly set cache size
Browse files Browse the repository at this point in the history
  • Loading branch information
vnugent committed Dec 8, 2024
1 parent f527f17 commit caf42b6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import express from 'express'
import cors from 'cors'
import * as http from 'http'
import bodyParser from 'body-parser'
import { InMemoryLRUCache } from '@apollo/utils.keyvaluecache'

import { applyMiddleware } from 'graphql-middleware'
import { graphqlSchema } from './graphql/resolvers.js'
Expand Down Expand Up @@ -47,7 +48,9 @@ export async function createServer (): Promise<{ app: express.Application, serve
introspection: true,
schema,
plugins: [ApolloServerPluginDrainHttpServer({ httpServer })],
cache: 'bounded'
cache: new InMemoryLRUCache({
max: 100
})
})
// server must be started before applying middleware
await server.start()
Expand Down

0 comments on commit caf42b6

Please sign in to comment.