From 37aa4e56f13180ae59072d3f86a7a88d5acaedd6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 19 Jul 2023 21:25:15 +0200 Subject: [PATCH] fix: do not use async callback with setInterval() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ChargingStation.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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); } } } -- 2.34.1