Version 1.0.1 - Fix de WebMetrics et de l'édit utilisateur
All checks were successful
Neutral/pipeline/head This commit looks good
All checks were successful
Neutral/pipeline/head This commit looks good
This commit is contained in:
@ -28,13 +28,17 @@ module.exports.getMetrics = function() {
|
||||
|
||||
var processed = 0
|
||||
|
||||
if(metrics.length == 0) {
|
||||
resolve(metricsToReturn)
|
||||
}
|
||||
|
||||
await metrics.forEach(async (metric) => {
|
||||
|
||||
// Try to connect to the metric server with the key in query params named "privatekey"
|
||||
// If the connection is successful, we add the metric to the list of metrics to return
|
||||
|
||||
const url = `http://${metric.address}:${metric.port}/metrics?privatekey=${metric.key}`
|
||||
const res = await fetch(url, {
|
||||
const fet = await fetch(url, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Accept": "application/json",
|
||||
@ -46,21 +50,33 @@ module.exports.getMetrics = function() {
|
||||
if(res) {
|
||||
metric.data = res
|
||||
metricsToReturn.push(metric)
|
||||
processed++
|
||||
} else {
|
||||
metric.data = "ERROR"
|
||||
metricsToReturn.push(metric)
|
||||
}
|
||||
|
||||
if(processed == metrics.length) {
|
||||
resolve(metricsToReturn)
|
||||
}
|
||||
|
||||
}).catch((err) => {
|
||||
metric.data = "ERROR"
|
||||
metricsToReturn.push(metric)
|
||||
processed++
|
||||
if(processed == metrics.length) {
|
||||
resolve(metricsToReturn)
|
||||
}
|
||||
})
|
||||
|
||||
processed++
|
||||
|
||||
|
||||
if(processed == metrics.length) {
|
||||
resolve(metricsToReturn)
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
Reference in New Issue
Block a user