Skip to content

Commit 88a527d

Browse files
committed
Current metrics moved inside of health metrics function
Current metrics is only needed within this function to compare the lengths between current metrics and health metrics. Instead of grabbging current metrics outside of the function it is now grabbing the current metrics data before the length check.
1 parent adcc071 commit 88a527d

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

chronos_npm_package/controllers/mongo.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,11 @@ mongo.communications = ({ microservice, slack, email }) => {
108108
mongo.health = async ({ microservice, interval, mode }) => {
109109
//MetricsModel tracks which metrics are selected in the MetricsContainer component
110110
//HealthModel tracks all the cpu health data in each of the services databases
111-
const getCurrentMets = async () => await MetricsModel.find({ mode });
112-
const currentMetrics = async () => await getCurrentMets()
113-
currentMetrics()
114111

115112
setInterval(() => {
116113
collectHealthData()
117114
.then(async healthMetrics => {
115+
const currentMetrics = await MetricsModel.find({mode})
118116

119117
if (currentMetrics.length !== healthMetrics.length) {
120118
await mongo.addMetrics(healthMetrics, mode, currentMetrics);

0 commit comments

Comments
 (0)