fix(network): apply connection timeout in server and extension hosts

Complete the runtime entrypoints from #3404 without changing address-family selection.
This commit is contained in:
Bohdan Triapitsyn
2026-09-07 20:37:46 +03:00
parent 5ae1a949c8
commit 45bc61f8f9
7 changed files with 74 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
import * as net from 'node:net';
// Mirrors the web runtime policy for distant quota endpoints. The extension
// host has its own Node fetch stack and does not inherit server defaults.
export function applyConnectAttemptTimeout(
netModule: Partial<Pick<typeof net, 'setDefaultAutoSelectFamilyAttemptTimeout'>> = net,
): boolean {
try {
if (!netModule.setDefaultAutoSelectFamilyAttemptTimeout) return false;
netModule.setDefaultAutoSelectFamilyAttemptTimeout(5_000);
return true;
} catch {
return false;
}
}