fix(quota): raise Node's 250ms connect-attempt cap for provider fetches (#3404)
Node's happy-eyeballs default (autoSelectFamilyAttemptTimeout=250ms) aborts every connect attempt to provider endpoints whose TCP handshake exceeds 250ms, so quota fetches from Node processes fail with "fetch failed" while the Bun-based opencode CLI path succeeds (#3399). Raise the per-attempt cap to 5s via a shared applyConnectAttemptTimeout() helper called from the two Node entrypoints that host the quota module: the Electron main process and the openchamber CLI. Family autoselection stays enabled (::1 and IPv6→IPv4 fallback preserved); runtimes without the setter are a no-op.
This commit is contained in:
@@ -37,6 +37,7 @@ import { createRelayDevTunnelBridge } from './relay-dev-tunnel.mjs';
|
||||
import { attachRendererRecovery } from './renderer-recovery.mjs';
|
||||
import { mintOutsideFileGrant } from '@openchamber/web/server/lib/fs/routes.js';
|
||||
import { fetchUpdateNotes } from '@openchamber/web/server/lib/changelog/update-notes.js';
|
||||
import { applyConnectAttemptTimeout } from '@openchamber/web/server/lib/network-defaults.js';
|
||||
|
||||
const execFileAsync = promisify(execFile);
|
||||
|
||||
@@ -104,6 +105,11 @@ if (shouldIgnoreLoopbackConnectionLimit({
|
||||
})) {
|
||||
app.commandLine.appendSwitch('ignore-connections-limit', '127.0.0.1,localhost');
|
||||
}
|
||||
// This process runs quota/provider fetches under Node/undici, whose happy-eyeballs
|
||||
// default aborts each connect attempt after 250ms — distant provider endpoints
|
||||
// routinely need longer handshakes, surfacing as "fetch failed" (#3399). No-op on
|
||||
// runtimes without the setter.
|
||||
applyConnectAttemptTimeout();
|
||||
|
||||
protocol.registerSchemesAsPrivileged([
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user