Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/rush",
"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.",
"type": "patch"
}
],
"packageName": "@microsoft/rush"
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@ export class RedisCobuildLockProvider implements ICobuildLockProvider {

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