-// Copyright Jerome Benoit. 2021-2023. All Rights Reserved.
+// Copyright Jerome Benoit. 2021-2024. All Rights Reserved.
import { closeSync, existsSync, mkdirSync, openSync, writeSync } from 'node:fs'
import { dirname } from 'node:path'
0,
'utf8'
)
- }).catch((error) => {
+ }).catch(error => {
handleFileException(
this.dbName,
FileType.PerformanceRecords,
public open (): void {
JsonFileStorage.performanceRecords = new Map<string, Statistics>()
try {
- if (this?.fd == null) {
+ if (this.fd == null) {
if (!existsSync(dirname(this.dbName))) {
mkdirSync(dirname(this.dbName), { recursive: true })
}
public close (): void {
JsonFileStorage.performanceRecords.clear()
try {
- if (this?.fd != null) {
+ if (this.fd != null) {
closeSync(this.fd)
- delete this?.fd
+ delete this.fd
}
} catch (error) {
handleFileException(
}
private checkPerformanceRecordsFile (): void {
- if (this?.fd == null) {
+ if (this.fd == null) {
throw new BaseError(
`${this.logPrefix} Performance records '${this.dbName}' file descriptor not found`
)