Skip to content

Commit

Permalink
Update app.js
Browse files Browse the repository at this point in the history
  • Loading branch information
manustars authored Oct 7, 2024
1 parent e1e2e86 commit 9a56428
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,19 @@ async function refreshMetrics() {

deviceStatusInfo.labels(rig.v4.mmv.workerName, rig.v4.versions[0], device.dsv.name, device.dsv.id, device.dsv.deviceClass, device.mdv.state)
.set(1);

device.speeds.forEach(speed => {
deviceSpeed.labels(rig.v4.mmv.workerName, device.dsv.name, device.dsv.id, device.dsv.deviceClass, speed.algorithm, speed.displaySuffix)
.set(+speed.speed);
});
// Modifica per gestire device.speeds indefinito o non array
try {
if (Array.isArray(device.speeds)) {
device.speeds.forEach(speed => {
deviceSpeed.labels(rig.v4.mmv.workerName, device.dsv.name, device.dsv.id, device.dsv.deviceClass, speed.algorithm, speed.displaySuffix)
.set(+speed.speed);
});
} else {
console.warn("Speeds is undefined or not an array for device:", device.dsv.name);
}
} catch (e) {
console.error("Errore durante il parsing del dispositivo: ", e);
}
} catch (e) {
console.error("Errore durante il parsing del dispositivo: ", e);
}
Expand Down

0 comments on commit 9a56428

Please sign in to comment.