X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FChargingStationWorker.ts;h=24ee468c0a5cc1244cd52890fc279d07fde70df7;hb=1fe0632adfa4067470497e2de02249fc84a4e218;hp=c4ff06eabf2cc601e0ee44a1ac66292df8267bc7;hpb=4c3c0d59f56be4d58e906e938c00390b41e0ca7f;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStationWorker.ts b/src/charging-station/ChargingStationWorker.ts index c4ff06ea..24ee468c 100644 --- a/src/charging-station/ChargingStationWorker.ts +++ b/src/charging-station/ChargingStationWorker.ts @@ -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,7 +32,7 @@ const addMessageListener = (): void => { // Conditionally export ThreadWorker instance for pool usage export let threadWorker: ThreadWorker; -if (ChargingStationUtils.workerPoolInUse()) { +if (Configuration.workerPoolInUse()) { threadWorker = new ThreadWorker(startChargingStation, { maxInactiveTime: WorkerConstants.POOL_MAX_INACTIVE_TIME, async: false, @@ -41,7 +40,7 @@ if (ChargingStationUtils.workerPoolInUse()) { } else { // Add message listener to start charging station from main thread addMessageListener(); - if (Utils.isUndefined(workerData) === false) { + if (workerData !== undefined) { startChargingStation(workerData as ChargingStationWorkerData); } }