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 7ea08ee

Browse filesBrowse files
TrottBethGriggs
authored andcommitted
test: improve reliability in http2-session-timeout
Use `setImmediate()` instead of `setTimeout()` to improve robustness of test-http2-session-timeout. Fixes: #20628 Backport-PR-URL: #22850 PR-URL: #22026 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent dcf04dc commit 7ea08ee
Copy full SHA for 7ea08ee

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

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

‎test/sequential/test-http2-session-timeout.js‎

Copy file name to clipboardExpand all lines: test/sequential/test-http2-session-timeout.js
+4-5Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
const common = require('../common');
44
if (!common.hasCrypto)
55
common.skip('missing crypto');
6-
const h2 = require('http2');
6+
const http2 = require('http2');
77

88
const serverTimeout = common.platformTimeout(200);
9-
const callTimeout = common.platformTimeout(20);
109
const mustNotCall = common.mustNotCall();
1110

12-
const server = h2.createServer();
11+
const server = http2.createServer();
1312
server.timeout = serverTimeout;
1413

1514
server.on('request', (req, res) => res.end());
@@ -19,7 +18,7 @@ server.listen(0, common.mustCall(() => {
1918
const port = server.address().port;
2019

2120
const url = `http://localhost:${port}`;
22-
const client = h2.connect(url);
21+
const client = http2.connect(url);
2322
const startTime = process.hrtime();
2423
makeReq();
2524

@@ -37,7 +36,7 @@ server.listen(0, common.mustCall(() => {
3736
const diff = process.hrtime(startTime);
3837
const milliseconds = (diff[0] * 1e3 + diff[1] / 1e6);
3938
if (milliseconds < serverTimeout * 2) {
40-
setTimeout(makeReq, callTimeout);
39+
setImmediate(makeReq);
4140
} else {
4241
server.removeListener('timeout', mustNotCall);
4342
server.close();

0 commit comments

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