From: Jérôme Benoit Date: Sat, 25 Sep 2021 11:27:22 +0000 (+0200) Subject: Add sanity check to ATG start X-Git-Tag: v1.1.8~3 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=b809adf11f05bbf85a335a457b871b90537918dd;p=e-mobility-charging-stations-simulator.git Add sanity check to ATG start Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/AutomaticTransactionGenerator.ts b/src/charging-station/AutomaticTransactionGenerator.ts index 9029b56a..3646b891 100644 --- a/src/charging-station/AutomaticTransactionGenerator.ts +++ b/src/charging-station/AutomaticTransactionGenerator.ts @@ -21,6 +21,10 @@ export default class AutomaticTransactionGenerator { } public start(): void { + if (this.started) { + logger.error(`${this.logPrefix()} trying to start while already started`); + return; + } const previousRunDuration = (this?.startDate && this?.lastRunDate) ? (this.lastRunDate.getTime() - this.startDate.getTime()) : 0; this.startDate = new Date(); this.lastRunDate = this.startDate; diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index dc95782d..14710b65 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -1003,7 +1003,7 @@ export default class ChargingStation { private startStationTemplateFileMonitoring(): void { try { - fs.watch(this.stationTemplateFile, async (event, filename): Promise => { + fs.watch(this.stationTemplateFile, (event, filename): void => { if (filename && event === 'change') { try { logger.debug(this.logPrefix() + ' Template file ' + this.stationTemplateFile + ' have changed, reload');