From: Jérôme Benoit Date: Thu, 18 Mar 2021 20:33:27 +0000 (+0100) Subject: src/charging-station/StationWorker.ts: renaming and typing X-Git-Tag: v1.0.1-0~83 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=56a74daeff10643ac9b9adebb037526b5096c1ee;hp=9ab7950c4e4b5f69ec598ef242cee677f9d4971e;p=e-mobility-charging-stations-simulator.git src/charging-station/StationWorker.ts: renaming and typing Signed-off-by: Jérôme Benoit --- diff --git a/.eslintrc b/.eslintrc index f44ad63d..68996a2e 100644 --- a/.eslintrc +++ b/.eslintrc @@ -73,14 +73,14 @@ } ], "block-spacing": "error", - "capitalized-comments": [ - "error", - "always", - { - "ignoreConsecutiveComments": true, - "ignorePattern": "pragma|ignored" - } - ], + // "capitalized-comments": [ + // "error", + // "always", + // { + // "ignoreConsecutiveComments": true, + // "ignorePattern": "pragma|ignored" + // } + // ], "eol-last": [ "error", "always" diff --git a/src/charging-station/StationWorker.ts b/src/charging-station/StationWorker.ts index edc306f9..45449c1b 100644 --- a/src/charging-station/StationWorker.ts +++ b/src/charging-station/StationWorker.ts @@ -7,18 +7,18 @@ import { ThreadWorker } from 'poolifier'; import Utils from '../utils/Utils'; // Conditionally export ThreadWorker instance for pool usage -export let threadWorker; +export let threadWorker: ThreadWorker; if (Utils.workerPoolInUse()) { threadWorker = new ThreadWorker(startChargingStation, { maxInactiveTime: Constants.WORKER_POOL_MAX_INACTIVE_TIME, async: false }); } else { - // Add listener to start charging station from main thread - addListener(); + // Add message listener to start charging station from main thread + addMessageListener(); if (!Utils.isUndefined(workerData)) { startChargingStation({ index: workerData.index as number, templateFile: workerData.templateFile as string }); } } -function addListener(): void { +function addMessageListener(): void { parentPort.on('message', (message) => { if (message.id === WorkerEvents.START_WORKER_ELEMENT) { startChargingStation(message.workerData);