From: Jérôme Benoit Date: Wed, 17 Mar 2021 21:13:23 +0000 (+0100) Subject: src/charging-station/StationWorker.ts: Remove useless branching X-Git-Tag: v1.0.1-0~87 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=74bbc59b015bd71ec4cdcdb6c9bf7a5cb7e63ff0;p=e-mobility-charging-stations-simulator.git src/charging-station/StationWorker.ts: Remove useless branching Signed-off-by: Jérôme Benoit --- 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)) {