1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

feat(client): expose socketTimeout option (#2965)

The maximum duration (in milliseconds) that the socket can remain idle (i.e., with no data sent or received) before being automatically closed. Default reconnectionStrategy will ignore the new SocketTimeoutError, but users are allowed to have custom strategies wich handle those errors in different ways
This commit is contained in:
Nikolay Karadzhov
2025-05-20 14:28:15 +03:00
committed by GitHub
parent d0a5c4c945
commit f3d1d3352e
4 changed files with 99 additions and 8 deletions

View File

@@ -16,6 +16,12 @@ export class ConnectionTimeoutError extends Error {
}
}
export class SocketTimeoutError extends Error {
constructor(timeout: number) {
super(`Socket timeout timeout. Expecting data, but didn't receive any in ${timeout}ms.`);
}
}
export class ClientClosedError extends Error {
constructor() {
super('The client is closed');