automaticTransactionGeneratorConfiguration: AutomaticTransactionGeneratorConfiguration,
chargingStation: ChargingStation
) {
+ this.started = false;
this.configuration = automaticTransactionGeneratorConfiguration;
this.chargingStation = chargingStation;
this.connectorsStatus = new Map<number, Status>();
this.stopConnectors();
- this.started = false;
}
public static getInstance(
export class Bootstrap {
private static instance: Bootstrap | null = null;
- private workerImplementation: WorkerAbstract<ChargingStationWorkerData> | null = null;
+ private workerImplementation: WorkerAbstract<ChargingStationWorkerData> | null;
private readonly uiServer!: AbstractUIServer;
private readonly storage!: Storage;
private numberOfChargingStationTemplates!: number;
private constructor() {
this.started = false;
+ this.workerImplementation = null;
this.workerScript = path.join(
path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../'),
'charging-station',
private readonly chargingStationWorkerBroadcastChannel: ChargingStationWorkerBroadcastChannel;
constructor(index: number, templateFile: string) {
+ this.started = false;
+ this.wsConnectionRestarted = false;
+ this.autoReconnectRetryCount = 0;
this.index = index;
this.templateFile = templateFile;
this.connectors = new Map<number, ConnectorStatus>();
this.sharedLRUCache = SharedLRUCache.getInstance();
this.authorizedTagsCache = AuthorizedTagsCache.getInstance();
this.chargingStationWorkerBroadcastChannel = new ChargingStationWorkerBroadcastChannel(this);
- this.started = false;
- this.wsConnectionRestarted = false;
- this.autoReconnectRetryCount = 0;
this.initialize();
}
if (this.isRegistered()) {
if (this.isInAcceptedState()) {
await this.startMessageSequence();
- this.wsConnectionRestarted && this.flushMessageBuffer();
}
} else {
logger.error(
`${this.logPrefix()} Registration failure: max retries reached (${this.getRegistrationMaxRetries()}) or retry disabled (${this.getRegistrationMaxRetries()})`
);
}
- this.started === false && (this.started = true);
- this.autoReconnectRetryCount = 0;
this.wsConnectionRestarted = false;
+ this.autoReconnectRetryCount = 0;
+ this.started = true;
parentPort.postMessage(MessageChannelUtils.buildUpdatedMessage(this));
} else {
logger.warn(
code
)}' and reason '${reason}'`
);
- await this.reconnect(code);
+ await this.reconnect();
break;
}
parentPort.postMessage(MessageChannelUtils.buildUpdatedMessage(this));
if (this.getAutomaticTransactionGeneratorConfigurationFromTemplate()?.enable === true) {
this.startAutomaticTransactionGenerator();
}
+ this.wsConnectionRestarted === true && this.flushMessageBuffer();
}
private async stopMessageSequence(
: false;
}
- private async reconnect(code: number): Promise<void> {
+ private async reconnect(): Promise<void> {
// Stop WebSocket ping
this.stopWebSocketPing();
// Stop heartbeat