refactor: split ChargingStationUtils class static methods into functions
[e-mobility-charging-stations-simulator.git] / src / charging-station / ChargingStationWorker.ts
index 741449e3b63e9b8126e4440c9c143116b61156b7..19f760e74565061f0b0e1e18cb74f2b0fdcbbd6d 100644 (file)
@@ -13,7 +13,7 @@ import { WorkerConstants, type WorkerMessage, WorkerMessageEvents } from '../wor
 const moduleName = 'ChargingStationWorker';
 
 /**
- * Create and start a charging station instance
+ * Creates and starts a charging station instance
  *
  * @param data - workerData
  */
@@ -37,11 +37,9 @@ class ChargingStationWorker extends AsyncResource {
   }
 }
 
-export let chargingStationWorker: ChargingStationWorker;
-// Conditionally export ThreadWorker instance for pool usage
-export let threadWorker: ThreadWorker;
+export let chargingStationWorker: ChargingStationWorker | ThreadWorker<ChargingStationWorkerData>;
 if (Configuration.workerPoolInUse()) {
-  threadWorker = new ThreadWorker<ChargingStationWorkerData>(startChargingStation, {
+  chargingStationWorker = new ThreadWorker<ChargingStationWorkerData>(startChargingStation, {
     maxInactiveTime: WorkerConstants.POOL_MAX_INACTIVE_TIME,
   });
 } else {