From: Jérôme Benoit Date: Mon, 4 Sep 2023 11:31:44 +0000 (+0200) Subject: perf: create and clear Map in performance code X-Git-Tag: v1.2.21~32 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=3f0734367ba34b15eb24c7d1e344ad8ae51a3d0d;p=e-mobility-charging-stations-simulator.git perf: create and clear Map in performance code Signed-off-by: Jérôme Benoit --- diff --git a/src/performance/storage/JsonFileStorage.ts b/src/performance/storage/JsonFileStorage.ts index 8aec3dc3..58680181 100644 --- a/src/performance/storage/JsonFileStorage.ts +++ b/src/performance/storage/JsonFileStorage.ts @@ -15,10 +15,7 @@ import { } from '../../utils'; export class JsonFileStorage extends Storage { - private static readonly performanceRecords: Map = new Map< - string, - Statistics - >(); + private static performanceRecords: Map; private fd?: number; @@ -48,6 +45,7 @@ export class JsonFileStorage extends Storage { } public open(): void { + JsonFileStorage.performanceRecords = new Map(); try { if (isNullOrUndefined(this?.fd)) { if (!existsSync(dirname(this.dbName))) { @@ -66,6 +64,7 @@ export class JsonFileStorage extends Storage { } public close(): void { + JsonFileStorage.performanceRecords.clear(); try { if (this?.fd) { closeSync(this.fd);