Make sure imstat doesn't break if the image API isn't used

This commit is contained in:
Essem 2022-01-16 20:12:54 -06:00
parent 24b828ccf6
commit 8b238a2316
No known key found for this signature in database
GPG Key ID: 7D497397CC3A2A8C
1 changed files with 10 additions and 8 deletions

View File

@ -42,15 +42,17 @@ class ImageWorker extends BaseServiceWorker {
async getRunning() {
const statuses = [];
for (const [address, connection] of this.connections) {
if (connection.conn.readyState !== 0 && connection.conn.readyState !== 1) {
continue;
if (process.env.API === "true") {
for (const [address, connection] of this.connections) {
if (connection.conn.readyState !== 0 && connection.conn.readyState !== 1) {
continue;
}
statuses.push({
address,
runningJobs: connection.njobs,
max: connection.max
});
}
statuses.push({
address,
runningJobs: connection.njobs,
max: connection.max
});
}
return statuses;
}