From: Jérôme Benoit Date: Sun, 4 Feb 2024 19:12:30 +0000 (+0100) Subject: refactor: cleanup charging station worker namespace X-Git-Tag: v1.2.35~6 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=bb8dc7253e50b925250889c90d931a4dc83c0cd3;p=e-mobility-charging-stations-simulator.git refactor: cleanup charging station worker namespace Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStationWorker.ts b/src/charging-station/ChargingStationWorker.ts index 21050d20..5bbfa6dd 100644 --- a/src/charging-station/ChargingStationWorker.ts +++ b/src/charging-station/ChargingStationWorker.ts @@ -11,11 +11,11 @@ import { Configuration } from '../utils/index.js' import { type WorkerMessage, WorkerMessageEvents } from '../worker/index.js' /** - * Creates and starts a charging station instance + * Adds and starts a charging station instance * * @param data - data sent to worker */ -const startChargingStation = (data?: ChargingStationWorkerData): void => { +const addChargingStation = (data?: ChargingStationWorkerData): void => { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion new ChargingStation(data!.index, data!.templateFile).start() } @@ -28,7 +28,7 @@ class ChargingStationWorker { switch (message.event) { case WorkerMessageEvents.startWorkerElement: try { - startChargingStation(message.data) + addChargingStation(message.data) parentPort?.postMessage({ event: WorkerMessageEvents.startedWorkerElement }) @@ -60,7 +60,7 @@ export let chargingStationWorker: | ChargingStationWorker | ThreadWorker if (Configuration.workerPoolInUse()) { - chargingStationWorker = new ThreadWorker(startChargingStation) + chargingStationWorker = new ThreadWorker(addChargingStation) } else { chargingStationWorker = new ChargingStationWorker() }