- private getWorkerImplementationInstance(): WorkerAbstract | null {
- if (!this.workerImplementationInstance) {
- this.workerImplementationInstance = WorkerFactory.getWorkerImplementation<StationWorkerData>(this.workerScript, Configuration.getWorkerProcess(),
- {
- startDelay: Configuration.getWorkerStartDelay(),
- poolMaxSize: Configuration.getWorkerPoolMaxSize(),
- poolMinSize: Configuration.getWorkerPoolMinSize(),
- elementsPerWorker: Configuration.getChargingStationsPerWorker(),
- poolOptions: {
- workerChoiceStrategy: Configuration.getWorkerPoolStrategy()
+ private initWorkerImplementation(): void {
+ this.workerImplementation = WorkerFactory.getWorkerImplementation<ChargingStationWorkerData>(this.workerScript, Configuration.getWorkerProcess(),
+ {
+ startDelay: Configuration.getWorkerStartDelay(),
+ poolMaxSize: Configuration.getWorkerPoolMaxSize(),
+ poolMinSize: Configuration.getWorkerPoolMinSize(),
+ elementsPerWorker: Configuration.getChargingStationsPerWorker(),
+ poolOptions: {
+ workerChoiceStrategy: Configuration.getWorkerPoolStrategy()
+ },
+ messageHandler: async (msg: ChargingStationWorkerMessage) => {
+ if (msg.id === ChargingStationWorkerMessageEvents.PERFORMANCE_STATISTICS) {
+ await this.storage.storePerformanceStatistics(msg.data);