From 56a74daeff10643ac9b9adebb037526b5096c1ee Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 18 Mar 2021 21:33:27 +0100 Subject: [PATCH 1/1] src/charging-station/StationWorker.ts: renaming and typing MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .eslintrc | 16 ++++++++-------- src/charging-station/StationWorker.ts | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) 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); -- 2.34.1