improved again
MODIFY
src/storage/mongodb/MongoDBStorage.ts
src/storage/mongodb/MongoDBStorage.ts
@@ -25,6 +25,7 @@ export default class MongoDBStorage {
private dbPingFailed = 0;
private readonly dbConfig: StorageConfiguration;
private readonly migrationConfig: MigrationConfiguration;
+ private connections = new Set<any>();
// Create database access
public constructor(dbConfig: StorageConfiguration) {
@@ -293,17 +294,18 @@ export default class MongoDBStorage {
readPreference: this.dbConfig.readPreference ? this.dbConfig.readPreference as ReadPreferenceMode : ReadPreferenceMode.secondaryPreferred
}
);
- const connections = new Set<any>();
this.mongoDBClient.on('connectionCreated',
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
(event) => global.monitoringServer.getGauge(Constants.MONGODB_CONNECTION_CREATED).inc(1)
);
this.mongoDBClient.on('connectionClosed',
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
(event) => global.monitoringServer.getGauge(Constants.MONGODB_CONNECTION_CLOSED).inc(1)
);
this.mongoDBClient.on('connectionReady',
(event) => {
- connections.add(event.connectionId);
- global.monitoringServer.getGauge(Constants.MONGODB_CONNECTION_READY).set(connections.size);
+ this.connections.add(event.connectionId);
+ global.monitoringServer.getGauge(Constants.MONGODB_CONNECTION_READY).set(this.connections.size);
}
);
this.database = this.mongoDBClient.db();

improved again