X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fperformance%2Fstorage%2FJsonFileStorage.ts;h=fcb35a4df0507569d941edbcb1aac223561e6be4;hb=e302df1d4573ef07df7c44a210a34e429f571814;hp=91a2d426e0a0c6b62bb3887317c211e3b7090ab5;hpb=2896e06dc8d72adf7150b23c941079f622f6f37c;p=e-mobility-charging-stations-simulator.git diff --git a/src/performance/storage/JsonFileStorage.ts b/src/performance/storage/JsonFileStorage.ts index 91a2d426..fcb35a4d 100644 --- a/src/performance/storage/JsonFileStorage.ts +++ b/src/performance/storage/JsonFileStorage.ts @@ -5,8 +5,7 @@ import fs from 'node:fs'; import lockfile from 'proper-lockfile'; import { FileType, type Statistics } from '../../types'; -import { FileUtils } from '../../utils/FileUtils'; -import { Utils } from '../../utils/Utils'; +import { Constants, FileUtils, Utils } from '../../utils'; import { Storage } from '../internal'; export class JsonFileStorage extends Storage { @@ -43,14 +42,12 @@ export class JsonFileStorage extends Storage { } await release(); }) - .catch(() => { - /* This is intentional */ - }); + .catch(Constants.EMPTY_FUNCTION); } public open(): void { try { - if (this?.fd === undefined || this?.fd === null) { + if (Utils.isNullOrUndefined(this?.fd)) { this.fd = fs.openSync(this.dbName, 'a+'); } } catch (error) {