fix: ensure all charging stations are started as an async resource
authorJérôme Benoit <jerome.benoit@sap.com>
Thu, 1 Jun 2023 02:07:56 +0000 (04:07 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Thu, 1 Jun 2023 02:07:56 +0000 (04:07 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStationWorker.ts

index 3fd74e361a663f2d04880d3ae78ac44835a2d4ac..19dd6f8dc2ed7960f5d7e9e3a29dcf6612ecf5e3 100644 (file)
@@ -39,10 +39,10 @@ if (Configuration.workerPoolInUse()) {
       );
     }
   }
-  // Add message listener to start charging station from main thread
+  // Add message listener to create and start charging station from the main thread
   parentPort?.on('message', (message: WorkerMessage<ChargingStationWorkerData>) => {
     if (message.id === WorkerMessageEvents.startWorkerElement) {
-      startChargingStation(message.data);
+      new ChargingStationWorker().run(message.data);
     }
   });
   if (workerData !== undefined) {