Skip to content

Commit 41f1e25

Browse files
committed
test: update test-timers-block-eventloop.js
When CPU is busy, the above sequential case fails occasionally, expand the timeout value to fix it. Fixes: #16310
1 parent 7be4a84 commit 41f1e25

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 commonTimeout = common.platformTimeout;
56

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

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

14-
const t3 = setTimeout(common.mustNotCall('eventloop blocked!'), 100);
15+
const t3 =
16+
setTimeout(common.mustNotCall('eventloop blocked!'), commonTimeout(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+
}, commonTimeout(50));

0 commit comments

Comments
 (0)