diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-08-19 16:29:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-19 23:29:01 +0800 |
commit | 1c6384b6a565a808cf40169919a7c155f15b5216 (patch) | |
tree | 1bffec183461776d6e4065e09edfdede49aeb3d0 /test/ufuzz | |
parent | e8db526f513ba324535fff040d651d4faacd89ae (diff) | |
download | tracifyjs-1c6384b6a565a808cf40169919a7c155f15b5216.tar.gz tracifyjs-1c6384b6a565a808cf40169919a7c155f15b5216.zip |
improve `ufuzz` duty cycle heuristic (#4057)
Diffstat (limited to 'test/ufuzz')
-rw-r--r-- | test/ufuzz/actions.js | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/test/ufuzz/actions.js b/test/ufuzz/actions.js index 53754a75..f9567d56 100644 --- a/test/ufuzz/actions.js +++ b/test/ufuzz/actions.js @@ -22,15 +22,14 @@ function read(url, callback) { }); } -var queued = 0, total = 0; -var earliest, latest; +var queued = 0, total = 0, earliest, now = Date.now(); process.on("beforeExit", function() { if (queued > 3) { process.stdout.write("0"); - } else if (total < 2) { - process.stdout.write("3600000"); + } else if (now - earliest > 0 && total > 1) { + process.stdout.write(Math.min(20 * (now - earliest) / (total - 1), 6300000).toFixed(0)); } else { - process.stdout.write(Math.min(20 * (latest - earliest) / (total - 1), 5400000).toFixed(0)); + process.stdout.write("3600000"); } }); read(base + "/actions/workflows/ufuzz.yml/runs?event=schedule", function(reply) { @@ -41,9 +40,9 @@ read(base + "/actions/workflows/ufuzz.yml/runs?event=schedule", function(reply) reply.jobs.forEach(function(job) { if (job.status == "queued") queued++; total++; + if (!job.started_at) return; var start = new Date(job.started_at); if (!(earliest < start)) earliest = start; - if (!(latest > start)) latest = start; }); }); }); |