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 24d08fe

Browse filesBrowse files
mithunsasidharanMylesBorins
authored andcommitted
test: refactored http test to use countdown
PR-URL: #17241 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 46c1d99 commit 24d08fe
Copy full SHA for 24d08fe

File tree

Expand file treeCollapse file tree

1 file changed

+3
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-2
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-http-end-throw-socket-handling.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-end-throw-socket-handling.js
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
'use strict';
2323
const common = require('../common');
24+
const Countdown = require('../common/countdown');
2425

2526
// Make sure that throwing in 'end' handler doesn't lock
2627
// up the socket forever.
@@ -29,10 +30,10 @@ const common = require('../common');
2930
// the same, we should not be so brittle and easily broken.
3031

3132
const http = require('http');
33+
const countdown = new Countdown(10, () => server.close());
3234

33-
let n = 0;
3435
const server = http.createServer((req, res) => {
35-
if (++n === 10) server.close();
36+
countdown.dec();
3637
res.end('ok');
3738
});
3839

0 commit comments

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