X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FIdTagsCache.ts;h=da4b38bfce79de421343e16f90dd2b6a17e85c6b;hb=4c6f35659fb67d395adc035ef80c566eb6eef79e;hp=f00a558971dad96a44b682150735f823d96fa63f;hpb=5199f9fdf202eb534948f165a0994e1993675aa8;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/IdTagsCache.ts b/src/charging-station/IdTagsCache.ts index f00a5589..da4b38bf 100644 --- a/src/charging-station/IdTagsCache.ts +++ b/src/charging-station/IdTagsCache.ts @@ -1,16 +1,16 @@ import { type FSWatcher, readFileSync } from 'node:fs' -import type { ChargingStation } from './ChargingStation.js' -import { getIdTagsFile } from './Helpers.js' import { FileType, IdTagDistribution } from '../types/index.js' import { handleFileException, isNotEmptyString, - logPrefix, logger, + logPrefix, secureRandom, watchJsonFile } from '../utils/index.js' +import type { ChargingStation } from './ChargingStation.js' +import { getIdTagsFile } from './Helpers.js' interface IdTagsCacheValueType { idTags: string[] @@ -143,8 +143,7 @@ export class IdTagsCache { logger.debug( `${this.logPrefix(file)} ${FileType.Authorization} file have changed, reload` ) - this.deleteIdTagsCache(file) - this.deleteIdTagsCacheIndexes(file) + this.deleteIdTags(file) } catch (error) { handleFileException( file, @@ -178,7 +177,7 @@ export class IdTagsCache { deleted.push(this.idTagsCachesAddressableIndexes.delete(key)) } } - return !deleted.some((value) => !value) + return !deleted.some(value => !value) } private getIdTagsCacheIndexesAddressableKey (prefix: string, uid: string): string {