Defined retry_strategy for redis. Closes #1292

This commit is contained in:
Hugo Abreu 2019-05-02 21:56:28 +01:00
parent c3221bddf2
commit f517c514d8

View file

@ -10,7 +10,14 @@ module.exports = function(config) {
const redis = require(redis_lib);
const client = redis.createClient({
host: config.redis_host,
connect_timeout: 10000
retry_strategy: options => {
if (options.total_retry_time > 10000) {
client.emit('error', 'Retry time exhausted');
return new Error('Retry time exhausted');
}
return 500;
}
});
client.ttlAsync = promisify(client.ttl);