Skip to content

Commit dbf9c5d

Browse files
fix(cobuilds): add socket + connect timeout (#5797)
* fix(cobuilds): add socket + connect timeout Signed-off-by: Aramis Sennyey <aramissennyeydd@users.noreply.github.com> * scope to just timeout additions Signed-off-by: Aramis Sennyey <aramissennyeydd@users.noreply.github.com> * rename changefile package Signed-off-by: Aramis Sennyey <aramissennyeydd@users.noreply.github.com> * rename changefile package Signed-off-by: Aramis Sennyey <aramissennyeydd@users.noreply.github.com> --------- Signed-off-by: Aramis Sennyey <aramissennyeydd@users.noreply.github.com> Co-authored-by: Aramis Sennyey <aramissennyeydd@users.noreply.github.com>
1 parent 518f379 commit dbf9c5d

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/rush",
5+
"comment": "Set Redis `connectTimeout` and `socketTimeout` so half-dead TCP connections (NAT/firewall) surface in seconds instead of stalling in-flight commands for many minutes while the kernel waits to give up.",
6+
"type": "patch"
7+
}
8+
],
9+
"packageName": "@microsoft/rush"
10+
}

rush-plugins/rush-redis-cobuild-plugin/src/RedisCobuildLockProvider.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,12 @@ export class RedisCobuildLockProvider implements ICobuildLockProvider {
5050

5151
public constructor(options: IRedisCobuildLockProviderOptions, rushSession: RushSession) {
5252
this._options = RedisCobuildLockProvider.expandOptionsWithEnvironmentVariables(options);
53-
// Provide a default reconnect strategy that prevents more than 5 reconnect attempts.
53+
// Detect half-dead connections quickly. Without `socketTimeout`, a silently-dropped
54+
// TCP connection (NAT/firewall) can stall in-flight commands for many minutes while
55+
// the kernel waits to surface the failure.
5456
this._options.socket = {
57+
connectTimeout: 10_000,
58+
socketTimeout: 30_000,
5559
reconnectStrategy: (count: number) => {
5660
this._terminal.writeErrorLine(`Redis client reconnecting attempt #${count}`);
5761
return count < 5 ? count * 1000 : false;

0 commit comments

Comments
 (0)