From bb8dc7253e50b925250889c90d931a4dc83c0cd3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 4 Feb 2024 20:12:30 +0100 Subject: [PATCH] refactor: cleanup charging station worker namespace MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ChargingStationWorker.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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() } -- 2.34.1