Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const server = new ApolloServer({
typeDefs,
resolvers,
tracing: true,
cacheControl: {
defaultMaxAge: 5,
stripFormattedExtensions: false,
calculateCacheControlHeaders: false,
},
dataSources: () => {
return {
nytimesAPI: new NYTIMESAPI(),
};
},
cache: new RedisCache({
connectTimeout: 5000,
reconnectOnError: function (err) {
console.log('Reconnect on error', err)
var targetError = 'READONLY'
if (err.message.slice(0, targetError.length) === targetError) {
// Only reconnect when the error starts with "READONLY"
return true
}
},
retryStrategy: function (times) {
console.log('Redis Retry', times)
if (times >= 3) {
return undefined
}
var delay = Math.min(times * 50, 2000)
return delay