From 74bbc59b015bd71ec4cdcdb6c9bf7a5cb7e63ff0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 17 Mar 2021 22:13:23 +0100 Subject: [PATCH] src/charging-station/StationWorker.ts: Remove useless branching MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/StationWorker.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/charging-station/StationWorker.ts b/src/charging-station/StationWorker.ts index 31452ce0..edc306f9 100644 --- a/src/charging-station/StationWorker.ts +++ b/src/charging-station/StationWorker.ts @@ -1,5 +1,5 @@ import { StationWorkerData, WorkerEvents } from '../types/Worker'; -import { isMainThread, parentPort, workerData } from 'worker_threads'; +import { parentPort, workerData } from 'worker_threads'; import ChargingStation from './ChargingStation'; import Constants from '../utils/Constants'; @@ -10,9 +10,7 @@ import Utils from '../utils/Utils'; export let threadWorker; if (Utils.workerPoolInUse()) { threadWorker = new ThreadWorker(startChargingStation, { maxInactiveTime: Constants.WORKER_POOL_MAX_INACTIVE_TIME, async: false }); -} - -if (!isMainThread) { +} else { // Add listener to start charging station from main thread addListener(); if (!Utils.isUndefined(workerData)) { -- 2.34.1