Skip to content

Commit

Permalink
test: fix flaky test-http-server-keepalive-req-gc
Browse files Browse the repository at this point in the history
Use `server` to keep the event loop open until the `ongc` listener runs.

PR-URL: #29347
Fixes: #29344
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
  • Loading branch information
Trott authored and BridgeAR committed Sep 4, 2019
1 parent f4f8827 commit bd1e8ea
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions test/parallel/test-http-server-keepalive-req-gc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if (common.isWindows) {

let client;
const server = createServer(common.mustCall((req, res) => {
onGC(req, { ongc: common.mustCall() });
onGC(req, { ongc: common.mustCall(() => { server.close(); }) });
req.resume();
req.on('end', common.mustCall(() => {
setImmediate(() => {
Expand All @@ -27,8 +27,6 @@ const server = createServer(common.mustCall((req, res) => {
res.end('hello world');
}));

server.unref();

server.listen(0, common.mustCall(() => {
client = connect(server.address().port);

Expand Down

0 comments on commit bd1e8ea

Please sign in to comment.