From 00b17b51cf0bc837156e5715c23314ec10fdb159 Mon Sep 17 00:00:00 2001 From: Igor Sheludko Date: Mon, 3 Jun 2024 18:30:40 +0200 Subject: [PATCH] Make test-http-server-keepalive-req-gc robust to GC heuristics (#186) (#189) * Fix test-http-server-keepalive-req-gc * Format --------- Co-authored-by: Etienne Pierre-Doray Co-authored-by: Etienne Pierre-doray --- test/parallel/test-http-server-keepalive-req-gc.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-http-server-keepalive-req-gc.js b/test/parallel/test-http-server-keepalive-req-gc.js index 0c68ebab763223..93310847d670a7 100644 --- a/test/parallel/test-http-server-keepalive-req-gc.js +++ b/test/parallel/test-http-server-keepalive-req-gc.js @@ -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');