net: increase network family autoselection timeout to 500ms · nodejs/node@506b79e

4 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -1905,7 +1905,7 @@ added:

19051905

-->

19061906
19071907

Gets the current default value of the `autoSelectFamilyAttemptTimeout` option of [`socket.connect(options)`][].

1908-

The initial default value is `250` or the value specified via the command line

1908+

The initial default value is `500` or the value specified via the command line

19091909

option `--network-family-autoselection-attempt-timeout`.

19101910
19111911

* Returns: {number} The current default value of the `autoSelectFamilyAttemptTimeout` option.

Original file line numberDiff line numberDiff line change

@@ -155,7 +155,7 @@ class EnvironmentOptions : public Options {

155155

int64_t heap_snapshot_near_heap_limit = 0;

156156

std::string heap_snapshot_signal;

157157

bool network_family_autoselection = true;

158-

uint64_t network_family_autoselection_attempt_timeout = 250;

158+

uint64_t network_family_autoselection_attempt_timeout = 500;

159159

uint64_t max_http_header_size = 16 * 1024;

160160

bool deprecation = true;

161161

bool force_async_hooks_checks = true;

Original file line numberDiff line numberDiff line change

@@ -184,8 +184,9 @@ function isPi() {

184184

}

185185

}

186186
187-

// When using high concurrency or in the CI we need much more time for each connection attempt

188-

net.setDefaultAutoSelectFamilyAttemptTimeout(platformTimeout(net.getDefaultAutoSelectFamilyAttemptTimeout() * 10));

187+

// When using high concurrency or in the CI we need much more time for each connection attempt.

188+

// Default 500ms becomes 2500ms for tests.

189+

net.setDefaultAutoSelectFamilyAttemptTimeout(platformTimeout(net.getDefaultAutoSelectFamilyAttemptTimeout() * 5));

189190

const defaultAutoSelectFamilyAttemptTimeout = net.getDefaultAutoSelectFamilyAttemptTimeout();

190191
191192

const buildType = process.config.target_defaults ?

Original file line numberDiff line numberDiff line change

@@ -7,4 +7,4 @@ const { platformTimeout } = require('../common');

77

const assert = require('assert');

88

const { getDefaultAutoSelectFamilyAttemptTimeout } = require('net');

99
10-

assert.strictEqual(getDefaultAutoSelectFamilyAttemptTimeout(), platformTimeout(123 * 10));

10+

assert.strictEqual(getDefaultAutoSelectFamilyAttemptTimeout(), platformTimeout(123 * 5));