Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cc28d2f

Browse filesBrowse files
mcollinadanielleadams
authored andcommitted
http: set lifo as the default scheduling strategy in Agent
PR-URL: #36685 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent ef62889 commit cc28d2f
Copy full SHA for cc28d2f

File tree

Expand file treeCollapse file tree

3 files changed

+8
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+8
-5
lines changed
Open diff view settings
Collapse file

‎doc/api/http.md‎

Copy file name to clipboardExpand all lines: doc/api/http.md
+4-1Lines changed: 4 additions & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ http.get({
113113
<!-- YAML
114114
added: v0.3.4
115115
changes:
116+
- version: REPLACEME
117+
pr-url: https://github.com/nodejs/node/pull/36685
118+
description: Change the default scheduling from 'fifo' to 'lifo'.
116119
- version:
117120
- v14.5.0
118121
- v12.19.0
@@ -159,7 +162,7 @@ changes:
159162
In case of a high rate of request per second,
160163
the `'fifo'` scheduling will maximize the number of open sockets,
161164
while the `'lifo'` scheduling will keep it as low as possible.
162-
**Default:** `'fifo'`.
165+
**Default:** `'lifo'`.
163166
* `timeout` {number} Socket timeout in milliseconds.
164167
This will set the timeout when the socket is created.
165168

Collapse file

‎lib/_http_agent.js‎

Copy file name to clipboardExpand all lines: lib/_http_agent.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function Agent(options) {
105105
this.keepAlive = this.options.keepAlive || false;
106106
this.maxSockets = this.options.maxSockets || Agent.defaultMaxSockets;
107107
this.maxFreeSockets = this.options.maxFreeSockets || 256;
108-
this.scheduling = this.options.scheduling || 'fifo';
108+
this.scheduling = this.options.scheduling || 'lifo';
109109
this.maxTotalSockets = this.options.maxTotalSockets;
110110
this.totalSocketCount = 0;
111111

Collapse file

‎test/parallel/test-http-agent-scheduling.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-agent-scheduling.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ function defaultTest() {
5656

5757
bulkRequest(url, agent, (ports) => {
5858
makeRequest(url, agent, (port) => {
59-
assert.strictEqual(ports[0], port);
59+
assert.strictEqual(ports[ports.length - 1], port);
6060
makeRequest(url, agent, (port) => {
61-
assert.strictEqual(ports[1], port);
61+
assert.strictEqual(ports[ports.length - 1], port);
6262
makeRequest(url, agent, (port) => {
63-
assert.strictEqual(ports[2], port);
63+
assert.strictEqual(ports[ports.length - 1], port);
6464
server.close();
6565
agent.destroy();
6666
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.