Skip to content

Commit c172bcd

Browse files
panvanodejs-github-bot
authored andcommitted
test: allow periodic flush to finish under load
Keep the event loop alive until the periodic write drains and let the test runner enforce the timeout. A one-second deadline can expire while asynchronous file I/O is still pending on a busy CI machine. Refs: nodejs/reliability#1690 Signed-off-by: Filip Skokan <panva.ip@gmail.com> Assisted-by: Codex PR-URL: #66722 Refs: nodejs/reliability#1686 Refs: nodejs/reliability#1687 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Guilherme Araújo <arauujogui@gmail.com>
1 parent 592a0bd commit c172bcd

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎test/parallel/test-fastutf8stream-periodicflush.js‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,12 @@ function runTests(sync) {
8585
minLength: 5000,
8686
periodicFlush: common.platformTimeout(10),
8787
});
88-
const timeout = setTimeout(
89-
common.mustNotCall('periodic flush did not complete'),
90-
common.platformTimeout(1000),
91-
);
88+
// Periodic flush timers are unrefed. Keep the event loop alive until the
89+
// write completes, and let the test runner enforce the timeout.
90+
const keepAlive = setInterval(() => {}, 1000);
9291

9392
stream.once('drain', common.mustCall(() => {
94-
clearTimeout(timeout);
93+
clearInterval(keepAlive);
9594
stream.destroy();
9695
readFile(dest, 'utf8', common.mustSucceed((data) => {
9796
assert.strictEqual(data, 'periodic flush\n');

0 commit comments

Comments
 (0)