Skip to content

Commit

Permalink
Make test-http-server-keepalive-req-gc robust to GC heuristics (nodej…
Browse files Browse the repository at this point in the history
…s#186) (nodejs#189)

* Fix test-http-server-keepalive-req-gc

* Format

---------

Co-authored-by: Etienne Pierre-Doray <etipdoray@gmail.com>
Co-authored-by: Etienne Pierre-doray <etiennep@chromium.org>
  • Loading branch information
3 people authored Jun 3, 2024
1 parent 32379a7 commit 00b17b5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/parallel/test-http-server-keepalive-req-gc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ const server = createServer(common.mustCall((req, res) => {
onGC(req, { ongc: common.mustCall(() => { server.close(); }) });
req.resume();
req.on('end', common.mustCall(() => {
setImmediate(() => {
setImmediate(async () => {
client.end();
global.gc();
await global.gc({ type: 'major', execution: 'async' });
await global.gc({ type: 'major', execution: 'async' });
});
}));
res.end('hello world');
Expand Down

0 comments on commit 00b17b5

Please sign in to comment.