From b809adf11f05bbf85a335a457b871b90537918dd Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 25 Sep 2021 13:27:22 +0200 Subject: [PATCH] Add sanity check to ATG start MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/AutomaticTransactionGenerator.ts | 4 ++++ src/charging-station/ChargingStation.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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'); -- 2.34.1