Skip to content

Commit 4a3525b

Browse files
etiennep-chromiumtargos
authored andcommitted
test: fix test-http-server-keepalive-req-gc
This changes adds a second explicit gc call in the test. Without this call, the test relies on gc eventually happening based, since the first call doesn't free the object. Relying on gc to eventually happen prevents changing GC heuristics unrelated to this test. The gc call is async; otherwise doing multiple sync GCs doesn't free the object. PR-URL: #53292 Reviewed-By: Luigi Pinca <[email protected]>
1 parent 78a9037 commit 4a3525b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ const server = createServer(common.mustCall((req, res) => {
1414
onGC(req, { ongc: common.mustCall(() => { server.close(); }) });
1515
req.resume();
1616
req.on('end', common.mustCall(() => {
17-
setImmediate(() => {
17+
setImmediate(async () => {
1818
client.end();
19-
global.gc();
19+
await global.gc({ type: 'major', execution: 'async' });
20+
await global.gc({ type: 'major', execution: 'async' });
2021
});
2122
}));
2223
res.end('hello world');

0 commit comments

Comments
 (0)