} from '../../utils';
export class JsonFileStorage extends Storage {
- private static readonly performanceRecords: Map<string, Statistics> = new Map<
- string,
- Statistics
- >();
+ private static performanceRecords: Map<string, Statistics>;
private fd?: number;
public storePerformanceStatistics(performanceStatistics: Statistics): void {
this.checkPerformanceRecordsFile();
+ JsonFileStorage.performanceRecords.set(performanceStatistics.id, performanceStatistics);
AsyncLock.runExclusive(AsyncLockType.performance, () => {
- JsonFileStorage.performanceRecords.set(performanceStatistics.id, performanceStatistics);
writeSync(
this.fd!,
JSONStringifyWithMapSupport([...JsonFileStorage.performanceRecords.values()], 2),
}
public open(): void {
+ JsonFileStorage.performanceRecords = new Map<string, Statistics>();
try {
if (isNullOrUndefined(this?.fd)) {
if (!existsSync(dirname(this.dbName))) {
}
public close(): void {
+ JsonFileStorage.performanceRecords.clear();
try {
if (this?.fd) {
closeSync(this.fd);