fix(ioredis): allow RedisOptions.retryStrategy to return number | false (#15858)

This commit is contained in:
Shun Sato 2017-04-21 23:30:16 +09:00 committed by Andy
parent 7290661a96
commit 50ae147fbb
2 changed files with 7 additions and 2 deletions

View File

@ -662,7 +662,11 @@ declare module IORedis {
*/
enableReadyCheck?: boolean;
keyPrefix?: string;
retryStrategy?: (times: number) => number;
/**
* When the return value isn't a number, ioredis will stop trying to reconnect.
* Fixed in: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/15858
*/
retryStrategy?: (times: number) => number | false;
reconnectOnError?: (error: Error) => boolean;
/**
* By default, if there is no active connection to the Redis server, commands are added to a queue

View File

@ -29,7 +29,8 @@ new Redis({
host: '127.0.0.1', // Redis host
family: 4, // 4 (IPv4) or 6 (IPv6)
password: 'auth',
db: 0
db: 0,
retryStrategy: function() { return false; }
})
var pub = new Redis();