X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=inline;f=src%2Fperformance%2Fstorage%2FMongoDBStorage.ts;h=c3c98022d4204c63aa6d940f7cac887d2424ed58;hb=a94f567f2d7cefba06e74fa0a957c096cf581b88;hp=48ce06d679d5131777542444bc46d87b3e40178b;hpb=a19b897d3aa5cb0f12177a42d8168121ce6ada97;p=e-mobility-charging-stations-simulator.git diff --git a/src/performance/storage/MongoDBStorage.ts b/src/performance/storage/MongoDBStorage.ts index 48ce06d6..c3c98022 100644 --- a/src/performance/storage/MongoDBStorage.ts +++ b/src/performance/storage/MongoDBStorage.ts @@ -2,10 +2,10 @@ import { MongoClient } from 'mongodb' -import { Storage } from './Storage.js' import { BaseError } from '../../exception/index.js' import { type Statistics, StorageType } from '../../types/index.js' import { Constants } from '../../utils/index.js' +import { Storage } from './Storage.js' export class MongoDBStorage extends Storage { private readonly client?: MongoClient @@ -20,6 +20,7 @@ export class MongoDBStorage extends Storage { public async storePerformanceStatistics (performanceStatistics: Statistics): Promise { try { + this.setPerformanceStatistics(performanceStatistics) this.checkDBConnection() await this.client ?.db(this.dbName) @@ -42,6 +43,7 @@ export class MongoDBStorage extends Storage { } public async close (): Promise { + this.clearPerformanceStatistics() try { if (this.connected && this.client != null) { await this.client.close()