tweak ufuzz job scheduling (#5659)
This commit is contained in:
@@ -11,7 +11,9 @@ exports.init = function(url, auth, num) {
|
|||||||
exports.should_stop = function(callback) {
|
exports.should_stop = function(callback) {
|
||||||
if (Date.now() > expires) return callback();
|
if (Date.now() > expires) return callback();
|
||||||
read(base + "/actions/runs?per_page=100", function(reply) {
|
read(base + "/actions/runs?per_page=100", function(reply) {
|
||||||
var runs = verify(reply, "workflow_runs").sort(function(a, b) {
|
var runs = verify(reply, "workflow_runs").filter(function(workflow) {
|
||||||
|
return workflow.status != "completed";
|
||||||
|
}).sort(function(a, b) {
|
||||||
return b.run_number - a.run_number;
|
return b.run_number - a.run_number;
|
||||||
});
|
});
|
||||||
var found = false, remaining = 20;
|
var found = false, remaining = 20;
|
||||||
@@ -20,14 +22,13 @@ exports.should_stop = function(callback) {
|
|||||||
do {
|
do {
|
||||||
workflow = runs.pop();
|
workflow = runs.pop();
|
||||||
if (!workflow) return;
|
if (!workflow) return;
|
||||||
if (is_cron(workflow) && workflow.run_number == run_number) found = true;
|
if (!is_cron(workflow)) break;
|
||||||
} while (!found && workflow.status == "completed");
|
if (workflow.run_number == run_number) found = true;
|
||||||
|
} while (!found);
|
||||||
read(workflow.jobs_url, function(reply) {
|
read(workflow.jobs_url, function(reply) {
|
||||||
if (!verify(reply, "jobs").every(function(job) {
|
verify(reply, "jobs").forEach(function(job) {
|
||||||
if (job.status == "completed") return true;
|
if (job.status != "completed") remaining--;
|
||||||
remaining--;
|
});
|
||||||
return found || !is_cron(workflow);
|
|
||||||
})) return;
|
|
||||||
if (remaining >= 0) {
|
if (remaining >= 0) {
|
||||||
next();
|
next();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user