refactor: stop !== shutdown semantic
[e-mobility-charging-stations-simulator.git] / src / charging-station / ChargingStationWorker.ts
index c4ff06eabf2cc601e0ee44a1ac66292df8267bc7..60d065642c7ef94585aa6902bf839354339dc6aa 100644 (file)
@@ -5,9 +5,8 @@ import { parentPort, workerData } from 'node:worker_threads';
 import { ThreadWorker } from 'poolifier';
 
 import { ChargingStation } from './ChargingStation';
-import { ChargingStationUtils } from './ChargingStationUtils';
 import type { ChargingStationWorkerData } from '../types';
-import { Utils } from '../utils';
+import { Configuration } from '../utils';
 import { WorkerConstants, type WorkerMessage, WorkerMessageEvents } from '../worker';
 
 /**
@@ -33,15 +32,14 @@ const addMessageListener = (): void => {
 
 // Conditionally export ThreadWorker instance for pool usage
 export let threadWorker: ThreadWorker;
-if (ChargingStationUtils.workerPoolInUse()) {
+if (Configuration.workerPoolInUse()) {
   threadWorker = new ThreadWorker<ChargingStationWorkerData>(startChargingStation, {
     maxInactiveTime: WorkerConstants.POOL_MAX_INACTIVE_TIME,
-    async: false,
   });
 } else {
   // Add message listener to start charging station from main thread
   addMessageListener();
-  if (Utils.isUndefined(workerData) === false) {
+  if (workerData !== undefined) {
     startChargingStation(workerData as ChargingStationWorkerData);
   }
 }