Fixed image server sorting, fixed improper imstat job counts
This commit is contained in:
parent
a9a404d1e1
commit
6d1bc63352
2 changed files with 3 additions and 3 deletions
|
@ -18,7 +18,7 @@ class ImageStatsCommand extends Command {
|
||||||
for (let i = 0; i < servers.length; i++) {
|
for (let i = 0; i < servers.length; i++) {
|
||||||
embed.embeds[0].fields.push({
|
embed.embeds[0].fields.push({
|
||||||
name: `Server ${i + 1}`,
|
name: `Server ${i + 1}`,
|
||||||
value: `Running Jobs: ${servers[i].runningJobs}\nQueued: ${Math.max(0, servers[i].runningJobs - servers[i].max)}\nMax Jobs: ${servers[i].max}`
|
value: `Running Jobs: ${Math.min(servers[i].runningJobs, servers[i].max)}\nQueued: ${Math.max(0, servers[i].runningJobs - servers[i].max)}\nMax Jobs: ${servers[i].max}`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return embed;
|
return embed;
|
||||||
|
|
|
@ -58,7 +58,7 @@ class ImageWorker extends BaseServiceWorker {
|
||||||
async chooseServer(ideal) {
|
async chooseServer(ideal) {
|
||||||
if (ideal.length === 0) throw "No available servers";
|
if (ideal.length === 0) throw "No available servers";
|
||||||
const sorted = ideal.sort((a, b) => {
|
const sorted = ideal.sort((a, b) => {
|
||||||
return b.load - a.load;
|
return a.load - b.load;
|
||||||
}).filter((e, i, array) => {
|
}).filter((e, i, array) => {
|
||||||
return !(e.load < array[0].load);
|
return !(e.load < array[0].load);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue