Commit c172bcd8a8e for nodejs
commit c172bcd8a8e3547b3858a0e0e0203849fcf6c491
Author: Filip Skokan <panva.ip@gmail.com>
Date: Wed Oct 14 11:37:37 2026 +0200
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: https://github.com/nodejs/reliability/issues/1690
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
Assisted-by: Codex
PR-URL: https://github.com/nodejs/node/pull/66722
Refs: https://github.com/nodejs/reliability/issues/1686
Refs: https://github.com/nodejs/reliability/issues/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>
diff --git a/test/parallel/test-fastutf8stream-periodicflush.js b/test/parallel/test-fastutf8stream-periodicflush.js
index 4889fa8b19e..ed9f8aef883 100644
--- a/test/parallel/test-fastutf8stream-periodicflush.js
+++ b/test/parallel/test-fastutf8stream-periodicflush.js
@@ -85,13 +85,12 @@ function runTests(sync) {
minLength: 5000,
periodicFlush: common.platformTimeout(10),
});
- const timeout = setTimeout(
- common.mustNotCall('periodic flush did not complete'),
- common.platformTimeout(1000),
- );
+ // Periodic flush timers are unrefed. Keep the event loop alive until the
+ // write completes, and let the test runner enforce the timeout.
+ const keepAlive = setInterval(() => {}, 1000);
stream.once('drain', common.mustCall(() => {
- clearTimeout(timeout);
+ clearInterval(keepAlive);
stream.destroy();
readFile(dest, 'utf8', common.mustSucceed((data) => {
assert.strictEqual(data, 'periodic flush\n');