X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fperformance%2Fstorage%2FMikroOrmStorage.ts;h=d1b84b8577d6bd267cf709cbc4cfd0880ceaea88;hb=db6ce8d86b3384fea4a55de8a543e7966f34685a;hp=d77b95a0cbee9bc3a4a993f21a34e241c7ac1e14;hpb=1abe401efb31da0c1ae37aee93a1379272091987;p=e-mobility-charging-stations-simulator.git diff --git a/src/performance/storage/MikroOrmStorage.ts b/src/performance/storage/MikroOrmStorage.ts index d77b95a0..d1b84b85 100644 --- a/src/performance/storage/MikroOrmStorage.ts +++ b/src/performance/storage/MikroOrmStorage.ts @@ -9,6 +9,7 @@ import { } from '@mikro-orm/core'; import { TsMorphMetadataProvider } from '@mikro-orm/reflection'; +import { Storage } from './Storage'; import { type MikroOrmDbType, PerformanceData, @@ -17,11 +18,10 @@ import { StorageType, } from '../../types'; import { Constants } from '../../utils'; -import { Storage } from '../internal'; export class MikroOrmStorage extends Storage { private storageType: StorageType; - private orm!: MikroORM | null; + private orm?: MikroORM; constructor(storageUri: string, logPrefix: string, storageType: StorageType) { super(storageUri, logPrefix); @@ -29,6 +29,7 @@ export class MikroOrmStorage extends Storage { this.dbName = this.getDBName(); } + // eslint-disable-next-line @typescript-eslint/no-unused-vars public async storePerformanceStatistics(performanceStatistics: Statistics): Promise { try { const performanceRecord = new PerformanceRecord(); @@ -52,7 +53,7 @@ export class MikroOrmStorage extends Storage { try { if (this?.orm) { await this.orm.close(); - this.orm = null; + delete this?.orm; } } catch (error) { this.handleDBError(this.storageType, error as Error);