refactor: cleanup worker export
authorJérôme Benoit <jerome.benoit@sap.com>
Wed, 28 Jun 2023 22:31:18 +0000 (00:31 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Wed, 28 Jun 2023 22:31:18 +0000 (00:31 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStationWorker.ts

index 741449e3b63e9b8126e4440c9c143116b61156b7..8b89750b1a7f23276530ac8132785a60b0111c2c 100644 (file)
@@ -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 {