while (this.connectorsStatus.get(connectorId)?.start === true) {
await this.waitChargingStationAvailable(connectorId)
await this.waitConnectorAvailable(connectorId)
+ await this.waitRunningTransactionStopped(connectorId)
if (!this.canStartConnector(connectorId)) {
this.stopConnector(connectorId)
break
)
logged = true
}
- await sleep(Constants.CHARGING_STATION_ATG_AVAILABILITY_TIME)
+ await sleep(Constants.DEFAULT_ATG_WAIT_TIME)
}
}
)
logged = true
}
- await sleep(Constants.CHARGING_STATION_ATG_AVAILABILITY_TIME)
+ await sleep(Constants.DEFAULT_ATG_WAIT_TIME)
+ }
+ }
+
+ private async waitRunningTransactionStopped (connectorId: number): Promise<void> {
+ const connectorStatus = this.chargingStation.getConnectorStatus(connectorId)
+ let logged = false
+ while (connectorStatus?.transactionStarted === true) {
+ if (!logged) {
+ logger.info(
+ `${this.logPrefix(
+ connectorId
+ )} transaction loop waiting for running transaction ${connectorStatus.transactionId} on connector ${connectorId} to be stopped`
+ )
+ logged = true
+ }
+ await sleep(Constants.DEFAULT_ATG_WAIT_TIME)
}
}
}
}
- public async stop (reason?: StopTransactionReason, stopTransactions?: boolean): Promise<void> {
+ public async stop (
+ reason?: StopTransactionReason,
+ stopTransactions = this.stationInfo?.stopTransactionsOnStopped
+ ): Promise<void> {
if (this.started) {
if (!this.stopping) {
this.stopping = true
stationInfo.resetTime =
stationTemplate.resetTime != null
? secondsToMilliseconds(stationTemplate.resetTime)
- : Constants.CHARGING_STATION_DEFAULT_RESET_TIME
+ : Constants.DEFAULT_CHARGING_STATION_RESET_TIME
return stationInfo
}
private async stopMessageSequence (
reason?: StopTransactionReason,
- stopTransactions = this.stationInfo?.stopTransactionsOnStopped
+ stopTransactions?: boolean
): Promise<void> {
this.internalStopMessageSequence()
// Stop ongoing transactions
static readonly DEFAULT_HEARTBEAT_INTERVAL = 60000 // Ms
static readonly DEFAULT_METER_VALUES_INTERVAL = 60000 // Ms
- static readonly CHARGING_STATION_DEFAULT_RESET_TIME = 60000 // Ms
- static readonly CHARGING_STATION_ATG_AVAILABILITY_TIME = 1000 // Ms
- static readonly CHARGING_STATION_ATG_INITIALIZATION_TIME = 1000 // Ms
+ static readonly DEFAULT_CHARGING_STATION_RESET_TIME = 60000 // Ms
+ static readonly DEFAULT_ATG_WAIT_TIME = 1000 // Ms
static readonly DEFAULT_ATG_CONFIGURATION: AutomaticTransactionGeneratorConfiguration =
Object.freeze({
enable: false,