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
Copy file name to clipboardExpand all lines: docs/client-configuration.md
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@
9
9
| socket.family |`0`| IP Stack version (one of `4 \| 6 \| 0`) |
10
10
| socket.path || Path to the UNIX Socket |
11
11
| socket.connectTimeout |`5000`| Connection timeout (in milliseconds) |
12
+
| socket.socketTimeout || The maximum duration (in milliseconds) that the socket can remain idle (i.e., with no data sent or received) before being automatically closed |
| 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 |
@@ -40,7 +41,12 @@ By default the strategy uses exponential backoff, but it can be overwritten like
40
41
```javascript
41
42
createClient({
42
43
socket: {
43
-
reconnectStrategy:retries=> {
44
+
reconnectStrategy: (retries, cause) => {
45
+
// By default, do not reconnect on socket timeout.
46
+
if (cause instanceof SocketTimeoutError) {
47
+
returnfalse;
48
+
}
49
+
44
50
// Generate a random jitter between 0 – 200 ms:
45
51
constjitter=Math.floor(Math.random() *200);
46
52
// Delay is an exponential back off, (times^2) * 50 ms, with a maximum value of 2000 ms:
@@ -23,6 +23,10 @@ type RedisSocketOptionsCommon = {
23
23
* 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.
0 commit comments