@@ -234,24 +234,28 @@ mongo.setQueryOnInterval = async config => {
234
234
///////
235
235
length = await mongo . addMetrics ( parsedArray , config . mode , currentMetricNames , model ) ;
236
236
}
237
- const documents = [ ] ;
238
- for ( const metric of parsedArray ) {
239
- /**
240
- * This will check if the current metric in the parsed array
241
- * evaluates to true within the currentMetricNames object
242
- * which is updated by the user when they select/deselect metrics on the electron app
243
- * helping to avoid overloading the db with unnecessary data.
244
- */
245
-
246
- if ( currentMetricNames [ metric . metric ] ) documents . push ( model ( metric ) ) ;
247
- }
248
- await model . insertMany ( parsedArray , err => {
249
- if ( err ) {
250
- console . error ( err )
251
- } else {
252
- console . log ( `${ config . mode } metrics recorded in MongoDB` )
237
+
238
+ if ( config . mode === 'docker' ) {
239
+ const documents = [ ] ;
240
+ for ( const metric of parsedArray ) {
241
+ /**
242
+ * This will check if the current metric in the parsed array
243
+ * evaluates to true within the currentMetricNames object
244
+ * which is updated by the user when they select/deselect metrics on the electron app
245
+ * helping to avoid overloading the db with unnecessary data.
246
+ */
247
+
248
+ if ( currentMetricNames [ metric . metric ] ) documents . push ( model ( metric ) ) ;
253
249
}
254
- } ) ;
250
+ await model . insertMany ( parsedArray , err => {
251
+ if ( err ) {
252
+ console . error ( err )
253
+ } else {
254
+ console . log ( `${ config . mode } metrics recorded in MongoDB` )
255
+ }
256
+ } ) ;
257
+ }
258
+
255
259
256
260
let allMetrics = await model . find ( { } ) ;
257
261
console . log ( 'allMetrics.length: ' , allMetrics . length ) ;
@@ -263,7 +267,7 @@ mongo.setQueryOnInterval = async config => {
263
267
// console.log(`${config.mode} metrics recorded in MongoDB`)
264
268
// })
265
269
. catch ( err => console . log ( `Error inserting ${ config . mode } documents in MongoDB: ` , err ) ) ;
266
- } , config . interval ) ;
270
+ } , 40000 ) ;
267
271
} ;
268
272
269
273
mongo . getSavedMetricsLength = async ( mode , currentMetricNames ) => {
0 commit comments