`${this.logPrefix()} Reservation expiration date interval is set to ${interval}
and starts on charging station now`,
);
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
- this.reservationExpirationSetInterval = setInterval(async (): Promise<void> => {
- const now = new Date();
- if (this.hasEvses) {
- for (const evseStatus of this.evses.values()) {
- for (const connectorStatus of evseStatus.connectors.values()) {
+ if (interval > 0) {
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
+ this.reservationExpirationSetInterval = setInterval(async (): Promise<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!.expiryDate < now) {
+ await this.removeReservation(
+ connectorStatus.reservation!,
+ ReservationTerminationReason.EXPIRED,
+ );
+ }
+ }
+ }
+ } else {
+ for (const connectorStatus of this.connectors.values()) {
if (connectorStatus.reservation!.expiryDate < now) {
await this.removeReservation(
connectorStatus.reservation!,
}
}
}
- } else {
- for (const connectorStatus of this.connectors.values()) {
- if (connectorStatus.reservation!.expiryDate < now) {
- await this.removeReservation(
- connectorStatus.reservation!,
- ReservationTerminationReason.EXPIRED,
- );
- }
- }
- }
- }, interval);
+ }, interval);
+ }
}
public restartReservationExpiryDateSetInterval(): void {