Defined retry_strategy for redis. Closes #1292
This commit is contained in:
parent
c3221bddf2
commit
f517c514d8
1 changed files with 8 additions and 1 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue