diff --git a/types/ioredis/index.d.ts b/types/ioredis/index.d.ts index d44278cad6..017fc04505 100644 --- a/types/ioredis/index.d.ts +++ b/types/ioredis/index.d.ts @@ -841,6 +841,17 @@ declare namespace IORedis { * Fixed in: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/15858 */ retryStrategy?(times: number): number | false; + /** + * By default, all pending commands will be flushed with an error every + * 20 retry attempts. That makes sure commands won't wait forever when + * the connection is down. You can change this behavior by setting + * `maxRetriesPerRequest`. + * + * Set maxRetriesPerRequest to `null` to disable this behavior, and + * every command will wait forever until the connection is alive again + * (which is the default behavior before ioredis v4). + */ + maxRetriesPerRequest?: number | null; /** * 1/true means reconnect, 2 means reconnect and resend failed command. Returning false will ignore * the error and do nothing. diff --git a/types/ioredis/ioredis-tests.ts b/types/ioredis/ioredis-tests.ts index f39edffa0a..848f0b2841 100644 --- a/types/ioredis/ioredis-tests.ts +++ b/types/ioredis/ioredis-tests.ts @@ -46,6 +46,7 @@ new Redis({ password: 'auth', db: 0, retryStrategy() { return false; }, + maxRetriesPerRequest: 20, showFriendlyErrorStack: true, tls: { servername: 'tlsservername'