workaround sporadic I/O lags in GitHub Actions (#5612)

This commit is contained in:
Alex Lam S.L
2022-08-09 21:33:32 +01:00
committed by GitHub
parent 9d37276986
commit 6c0e522922
2 changed files with 12 additions and 9 deletions

View File

@@ -15,6 +15,7 @@ jobs:
env:
NODE: ${{ matrix.node }}
TYPE: ${{ matrix.script }}
UGLIFY_GITHUB_LAG: 10000
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3

View File

@@ -1,13 +1,14 @@
var fs = require("fs");
var config = {
limit: 10000,
timeout: function(limit) {
this.limit = limit;
}
this.limit = limit + lag;
},
};
var lag = +process.env["UGLIFY_GITHUB_LAG"] || 0;
var tasks = [];
var titles = [];
config.timeout(10000);
describe = function(title, fn) {
config = Object.create(config);
titles.push(title);
@@ -21,10 +22,11 @@ it = function(title, fn) {
fn.titles.push(title);
tasks.push(fn);
};
fs.readdirSync("test/mocha").filter(function(file) {
(function(arg) {
return arg ? [ arg ] : fs.readdirSync("test/mocha").filter(function(file) {
return /\.js$/.test(file);
}).forEach(function(file) {
});
})(process.argv[2]).forEach(function(file) {
require("./mocha/" + file);
});
@@ -66,12 +68,12 @@ process.nextTick(function run() {
if (task.length) {
task.timeout = function(limit) {
clearTimeout(timer);
task.limit = limit;
task.limit = limit + lag;
timer = setTimeout(function() {
raise(new Error("Timed out: exceeds " + limit + "ms"));
}, limit);
};
task.timeout(task.limit);
task.timeout(task.limit - lag);
process.on("uncaughtException", raise);
task.call(task, done);
} else {