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.

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>
  • Loading branch information
zhangzifa authored and gibfahn committed Oct 31, 2017
1 parent 6ac7eef commit 0510f42
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 platformTimeout = common.platformTimeout;

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

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

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

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

0 comments on commit 0510f42

Please sign in to comment.