Merge pull request #1322 from hugomiguelabreu/master

Defined retry_strategy for redis. Closes #1292
This commit is contained in:
Danny Coates 2019-05-02 15:05:35 -07:00 committed by GitHub
commit 8f17c86611
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,14 @@ module.exports = function(config) {
const redis = require(redis_lib); const redis = require(redis_lib);
const client = redis.createClient({ const client = redis.createClient({
host: config.redis_host, 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); client.ttlAsync = promisify(client.ttl);