Skip to content

Commit

Permalink
test: update test-timers-block-eventloop.js
Browse files Browse the repository at this point in the history
When CPU is busy, the above sequential case fails occasionally,
expand the timeout value to fix it.

Fixes: nodejs#16310
  • Loading branch information
zhangzifa committed Oct 20, 2017
1 parent 7be4a84 commit 41f1e25
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions test/sequential/test-timers-block-eventloop.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@

const common = require('../common');
const fs = require('fs');
const commonTimeout = common.platformTimeout;

const t1 = setInterval(() => {
common.busyLoop(12);
}, 10);
common.busyLoop(commonTimeout(12));
}, common.platformTimeout(10));

const t2 = setInterval(() => {
common.busyLoop(15);
}, 10);
common.busyLoop(commonTimeout(15));
}, commonTimeout(10));

const t3 = setTimeout(common.mustNotCall('eventloop blocked!'), 100);
const t3 =
setTimeout(common.mustNotCall('eventloop blocked!'), commonTimeout(200));

setTimeout(function() {
fs.stat('./nonexistent.txt', (err, stats) => {
fs.stat('/dev/nonexistent', (err, stats) => {
clearInterval(t1);
clearInterval(t2);
clearTimeout(t3);
});
}, 50);
}, commonTimeout(50));

0 comments on commit 41f1e25

Please sign in to comment.