src/charging-station/StationWorker.ts: Remove useless branching
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 17 Mar 2021 21:13:23 +0000 (22:13 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 17 Mar 2021 21:13:23 +0000 (22:13 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/charging-station/StationWorker.ts

index 31452ce0149225884e64d92943625fe775e0102a..edc306f9916cbeded55af1123b67da7816ee26d6 100644 (file)
@@ -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<StationWorkerData>(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)) {