X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FChargingStationWorker.ts;h=70d960119901d4a63c037c1032c6310d6c2d1b5c;hb=e843aa4048c6bfcad2d8e54763b649eda57dbcb3;hp=741449e3b63e9b8126e4440c9c143116b61156b7;hpb=d58b442097da31f8b974d51aef63c64470d9ab48;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStationWorker.ts b/src/charging-station/ChargingStationWorker.ts index 741449e3..70d96011 100644 --- a/src/charging-station/ChargingStationWorker.ts +++ b/src/charging-station/ChargingStationWorker.ts @@ -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 */ @@ -30,18 +30,16 @@ class ChargingStationWorker extends AsyncResource { this.runInAsyncScope( startChargingStation.bind(this) as (data: ChargingStationWorkerData) => void, this, - message.data + message.data, ); } }); } } -export let chargingStationWorker: ChargingStationWorker; -// Conditionally export ThreadWorker instance for pool usage -export let threadWorker: ThreadWorker; +export let chargingStationWorker: ChargingStationWorker | ThreadWorker; if (Configuration.workerPoolInUse()) { - threadWorker = new ThreadWorker(startChargingStation, { + chargingStationWorker = new ThreadWorker(startChargingStation, { maxInactiveTime: WorkerConstants.POOL_MAX_INACTIVE_TIME, }); } else {