From: Jérôme Benoit Date: Wed, 19 Jul 2023 19:25:15 +0000 (+0200) Subject: fix: do not use async callback with setInterval() X-Git-Tag: v1.2.19~1 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=37aa4e56f13180ae59072d3f86a7a88d5acaedd6;p=e-mobility-charging-stations-simulator.git fix: do not use async callback with setInterval() Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index d130392e..0d1534f1 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -1025,27 +1025,26 @@ export class ChargingStation { and starts on charging station now`, ); if (interval > 0) { - // eslint-disable-next-line @typescript-eslint/no-misused-promises - this.reservationExpirationSetInterval = setInterval(async (): Promise => { + this.reservationExpirationSetInterval = setInterval((): void => { const now = new Date(); if (this.hasEvses) { for (const evseStatus of this.evses.values()) { for (const connectorStatus of evseStatus.connectors.values()) { if (connectorStatus.reservation && connectorStatus.reservation.expiryDate < now) { - await this.removeReservation( + this.removeReservation( connectorStatus.reservation, ReservationTerminationReason.EXPIRED, - ); + ).catch(Constants.EMPTY_FUNCTION); } } } } else { for (const connectorStatus of this.connectors.values()) { if (connectorStatus.reservation && connectorStatus.reservation.expiryDate < now) { - await this.removeReservation( + this.removeReservation( connectorStatus.reservation, ReservationTerminationReason.EXPIRED, - ); + ).catch(Constants.EMPTY_FUNCTION); } } }