Skip to content

Commit 0510f42

Browse files
zhangzifagibfahn
authored andcommitted
test: update test-timers-block-eventloop.js
When CPU is busy, the above sequential case fails occasionally, expand the timeout value to fix it. PR-URL: #16314 Fixes: #16310 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
1 parent 6ac7eef commit 0510f42

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

test/sequential/test-timers-block-eventloop.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,23 @@
22

33
const common = require('../common');
44
const fs = require('fs');
5+
const platformTimeout = common.platformTimeout;
56

67
const t1 = setInterval(() => {
7-
common.busyLoop(12);
8-
}, 10);
8+
common.busyLoop(platformTimeout(12));
9+
}, platformTimeout(10));
910

1011
const t2 = setInterval(() => {
11-
common.busyLoop(15);
12-
}, 10);
12+
common.busyLoop(platformTimeout(15));
13+
}, platformTimeout(10));
1314

14-
const t3 = setTimeout(common.mustNotCall('eventloop blocked!'), 100);
15+
const t3 =
16+
setTimeout(common.mustNotCall('eventloop blocked!'), platformTimeout(200));
1517

1618
setTimeout(function() {
17-
fs.stat('./nonexistent.txt', (err, stats) => {
19+
fs.stat('/dev/nonexistent', (err, stats) => {
1820
clearInterval(t1);
1921
clearInterval(t2);
2022
clearTimeout(t3);
2123
});
22-
}, 50);
24+
}, platformTimeout(50));

0 commit comments

Comments
 (0)