X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcharging-station%2FChargingStationWorker.ts;h=60d065642c7ef94585aa6902bf839354339dc6aa;hb=fca8bc64968004b4018a4d766b2121ced4fee943;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..60d06564 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,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(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); } }