for (const connector in this.chargingStation.connectors) {
const connectorId = Utils.convertToInt(connector);
if (connectorId > 0) {
- // Avoid hogging the event loop with a busy loop
- setImmediate(() => {
- this.startConnector(connectorId).catch(() => { /* This is intentional */ });
- });
+ this.startConnector(connectorId);
}
}
}
}
}
- private async startConnector(connectorId: number): Promise<void> {
+ private async internalStartConnector(connectorId: number): Promise<void> {
this.initStartConnectorStatus(connectorId);
logger.info(this.logPrefix(connectorId) + ' started on connector and will run for ' + Utils.formatDurationMilliSeconds(this.connectorsStatus.get(connectorId).stopDate.getTime() - this.connectorsStatus.get(connectorId).startDate.getTime()));
while (this.connectorsStatus.get(connectorId).start) {
logger.debug(`${this.logPrefix(connectorId)} connector status %j`, this.connectorsStatus.get(connectorId));
}
+ private startConnector(connectorId: number): void {
+ // Avoid hogging the event loop with a busy loop
+ setImmediate(() => {
+ this.internalStartConnector(connectorId).catch(() => { /* This is intentional */ });
+ });
+ }
+
private stopConnector(connectorId: number): void {
this.connectorsStatus.set(connectorId, { ...this.connectorsStatus.get(connectorId), start: false });
}