You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Default reconnect strategy uses exponential backoff and jitter (#2736)
* Default reconnect strategy uses exponential backoff and jitter
Both are recommended parts of client reconnect strategies to prevent
thundering herd problems when many clients lose their connection at once
(for example, during a Redis upgrade).
* Move default retry strategy to constant
* Plain english explanation of default 'socket.reconnectStrategy'
* Extract default connect strategy into helper function
| socket.keepAliveInitialDelay |`5000`| If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket |
15
15
| socket.tls || See explanation and examples [below](#TLS)|
16
-
| socket.reconnectStrategy |`retries => Math.min(retries * 50, 500)`| A function containing the [Reconnect Strategy](#reconnect-strategy) logic |
16
+
| socket.reconnectStrategy |Exponential backoff with a maximum of 2000 ms; plus 0-200 ms random jitter. | A function containing the [Reconnect Strategy](#reconnect-strategy) logic |
| password || ACL password or the old "--requirepass" password |
19
19
| name || Client name ([see `CLIENT SETNAME`](https://redis.io/commands/client-setname)) |
@@ -35,12 +35,19 @@ When the socket closes unexpectedly (without calling `.quit()`/`.disconnect()`),
35
35
2.`number` -> wait for `X` milliseconds before reconnecting.
36
36
3.`(retries: number, cause: Error) => false | number | Error` -> `number` is the same as configuring a `number` directly, `Error` is the same as `false`, but with a custom error.
37
37
38
-
By default the strategy is `Math.min(retries * 50, 500)`, but it can be overwritten like so:
38
+
By default the strategy uses exponential backoff, but it can be overwritten like so:
0 commit comments