this.uiServer = UIServerFactory.getUIServerImplementation(
Configuration.getConfigurationSection<UIServerConfiguration>(ConfigurationSection.uiServer),
);
- this.on(ChargingStationWorkerMessageEvents.started, this.workerEventStarted);
- this.on(ChargingStationWorkerMessageEvents.stopped, this.workerEventStopped);
- this.on(ChargingStationWorkerMessageEvents.updated, this.workerEventUpdated);
- this.on(
- ChargingStationWorkerMessageEvents.performanceStatistics,
- this.workerEventPerformanceStatistics,
- );
Configuration.configurationChangeCallback = async () => Bootstrap.getInstance().restart(false);
}
if (this.started === false) {
if (this.starting === false) {
this.starting = true;
+ this.on(ChargingStationWorkerMessageEvents.started, this.workerEventStarted);
+ this.on(ChargingStationWorkerMessageEvents.stopped, this.workerEventStopped);
+ this.on(ChargingStationWorkerMessageEvents.updated, this.workerEventUpdated);
+ this.on(
+ ChargingStationWorkerMessageEvents.performanceStatistics,
+ this.workerEventPerformanceStatistics,
+ );
this.initializeCounters();
const workerConfiguration = Configuration.getConfigurationSection<WorkerConfiguration>(
ConfigurationSection.worker,
}
await this.workerImplementation?.stop();
delete this.workerImplementation;
- this.uiServer?.stop();
+ this.removeAllListeners();
await this.storage?.close();
delete this.storage;
this.resetCounters();
public async restart(stopChargingStations?: boolean): Promise<void> {
await this.stop(stopChargingStations);
+ Configuration.getConfigurationSection<UIServerConfiguration>(ConfigurationSection.uiServer)
+ .enabled === false && this.uiServer?.stop();
await this.start();
}
? Math.round(this.numberOfChargingStations / (availableParallelism() * 1.5))
: 1;
break;
- case 'single':
+ case 'all':
elementsPerWorker = this.numberOfChargingStations;
break;
}
this.stop()
.then(() => {
console.info(`${chalk.green('Graceful shutdown')}`);
+ this.uiServer?.stop();
// stop() asks for charging stations to stop by default
this.waitChargingStationsStopped()
.then(() => {