Make sure imstat doesn't break if the image API isn't used
This commit is contained in:
parent
24b828ccf6
commit
8b238a2316
1 changed files with 10 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue