Skip to content

Commit

Permalink
server: use env for update intervals
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsenasm committed Oct 21, 2023
1 parent e337ca1 commit e24b3de
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const password = process.env.PASSWORD || "supersecret";
const enableHTTPS = process.env.ENABLE_HTTPS === "true";
const legoPath = process.env.LEGO_PATH;
const httpsHostname = process.env.HTTPS_HOSTNAME;
const dockerUpdateInterval = parseInt(process.env.DOCKER_UPDATE_INTERVAL || "1000");
const metricsUpdateInterval = parseInt(process.env.METRICS_UPDATE_INTERVAL|| "5000");

const _nodeExporterServiceNameRegex = process.env.NODE_EXPORTER_SERVICE_NAME_REGEX || "";
const useNodeExporter = _nodeExporterServiceNameRegex !== "";
Expand Down Expand Up @@ -590,19 +592,19 @@ setInterval(() => { // update docker data
publish(listeners, data);
})
.catch(e => console.error('Could not publish', e)); // eslint-disable-line no-console
}, 1000); // refreshs each 1s
}, dockerUpdateInterval); // refreshs each 1s

setInterval(() => { // update node data
fetchNodeMetrics({ lastData, lastRunningNodeExportes, lastNodeMetrics }, (nodeMetrics) => {
lastNodeMetrics = nodeMetrics;
})
}, 5000); // refreshs each 5s
}, metricsUpdateInterval); // refreshs each 5s

setInterval(() => { // update node data
fetchTasksMetrics({ lastRunningCadvisors, lastRunningTasksMetrics, lastRunningTasksID }, (runningTasksMetrics) => {
lastRunningTasksMetrics = runningTasksMetrics;
})
}, 5000); // refreshs each 5s
}, metricsUpdateInterval); // refreshs each 5s

function onWSConnection(ws, req) {
let params = undefined;
Expand Down

0 comments on commit e24b3de

Please sign in to comment.