Commit 909d6a34 authored by Daniel Smith's avatar Daniel Smith

Fix web index ready check locgic

parent 55e50b9e
......@@ -1245,6 +1245,7 @@ function homePage(req, res) {
}
readyEmitter.on("readyCheck", function () {
console.log(readyChecklist)
// All done constructing the page. Send it to the requester.
if (Object.values(readyChecklist).every((o) => o === true)) {
fetch(`http://${domain}:${webPort}/templates/index.mustache`)
......@@ -1275,24 +1276,28 @@ function homePage(req, res) {
readyChecklist.localJobs = true;
readyEmitter.emit('readyCheck');
}
}
if (jobQueue.length != 0) {
readyEmitter.on("localQueueItemFinished", () => {
if ((queueFinishedCount += 1) == jobQueue.length) {
view.queuedJobs += "</ul></br>";
readyChecklist.localQueue = true;
readyEmitter.emit('readyCheck');
}
});
view.queuedJobs += "<h4>Queued:</h4><ul>";
for (let i = jobQueue.length - 1; i >= 0; i--) {
view.queuedJobs += toolbox.jobFormatter(jobQueue[i], hosts, (job) => {
view.queuedJobs += job;
readyEmitter.emit("localQueueItemFinished");
if (jobQueue.length != 0) {
readyEmitter.on("localQueueItemFinished", () => {
if ((queueFinishedCount += 1) == jobQueue.length) {
view.queuedJobs += "</ul></br>";
readyChecklist.localQueue = true;
readyEmitter.emit('readyCheck');
}
});
view.queuedJobs += "<h4>Queued:</h4><ul>";
for (let i = jobQueue.length - 1; i >= 0; i--) {
view.queuedJobs += toolbox.jobFormatter(jobQueue[i], hosts, (job) => {
view.queuedJobs += job;
readyEmitter.emit("localQueueItemFinished");
});
}
} else {
readyChecklist.localQueue = true;
readyEmitter.emit('readyCheck');
}
} else {
readyChecklist.localJobs = true;
readyChecklist.localQueue = true;
readyEmitter.emit('readyCheck');
}
......@@ -1316,7 +1321,10 @@ function homePage(req, res) {
})
}
} else {
view.remoteJobs += `💤... No running jobs`;
readyChecklist.remoteJobs = true;
readyEmitter.emit('readyCheck');
}
if (remoteQueuedJobs.length != 0) {
......@@ -1335,6 +1343,9 @@ function homePage(req, res) {
readyEmitter.emit("remoteQueueFinished");
});
}
} else {
readyChecklist.remoteQueue = true;
readyEmitter.emit('readyCheck');
}
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment