Skip to content

Commit e3cfbba

Browse files
TrottBridgeAR
authored andcommitted
test: fix flaky test-http-server-keepalive-req-gc
Use `server` to keep the event loop open until the `ongc` listener runs. PR-URL: #29347 Fixes: #29344 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
1 parent 527f118 commit e3cfbba

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

test/parallel/test-http-server-keepalive-req-gc.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if (common.isWindows) {
1616

1717
let client;
1818
const server = createServer(common.mustCall((req, res) => {
19-
onGC(req, { ongc: common.mustCall() });
19+
onGC(req, { ongc: common.mustCall(() => { server.close(); }) });
2020
req.resume();
2121
req.on('end', common.mustCall(() => {
2222
setImmediate(() => {
@@ -27,8 +27,6 @@ const server = createServer(common.mustCall((req, res) => {
2727
res.end('hello world');
2828
}));
2929

30-
server.unref();
31-
3230
server.listen(0, common.mustCall(() => {
3331
client = connect(server.address().port);
3432

0 commit comments

Comments
 (0)