Skip to content

Commit

Permalink
Add retry strategy for redis
Browse files Browse the repository at this point in the history
  • Loading branch information
mugli committed Aug 14, 2019
1 parent 8c60b3d commit a5212e2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/apollo.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ const IORedis = require('ioredis');
const { schema } = require('./graphql-schema');

const apollo = (redisConf = {}) => {
const redis = new IORedis(redisConf);
const redis = new IORedis({
...redisConf,
retryStrategy: function retryStrategy(times) {
const delay = Math.min(times * 50, 2000);
return delay;
}
});

const apl = new ApolloServer({
schema,
Expand Down

0 comments on commit a5212e2

Please sign in to comment.