From: Jérôme Benoit Date: Sat, 9 Sep 2023 19:58:33 +0000 (+0200) Subject: refactor: remove unneeded redefinition of poolifier defaults X-Git-Tag: v1.2.22~30 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=bcbb76a6957d1c0bad4a51c040af58788b8b186f;p=e-mobility-charging-stations-simulator.git refactor: remove unneeded redefinition of poolifier defaults Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStationWorker.ts b/src/charging-station/ChargingStationWorker.ts index 7c7a5235..003d9fea 100644 --- a/src/charging-station/ChargingStationWorker.ts +++ b/src/charging-station/ChargingStationWorker.ts @@ -9,7 +9,7 @@ import { ChargingStation } from './ChargingStation'; import { BaseError } from '../exception'; import type { ChargingStationWorkerData } from '../types'; import { Configuration } from '../utils'; -import { POOL_MAX_INACTIVE_TIME, type WorkerMessage, WorkerMessageEvents } from '../worker'; +import { type WorkerMessage, WorkerMessageEvents } from '../worker'; const moduleName = 'ChargingStationWorker'; @@ -63,9 +63,7 @@ class ChargingStationWorker extends AsyncResource { export let chargingStationWorker: ChargingStationWorker | ThreadWorker; if (Configuration.workerPoolInUse()) { - chargingStationWorker = new ThreadWorker(startChargingStation, { - maxInactiveTime: POOL_MAX_INACTIVE_TIME, - }); + chargingStationWorker = new ThreadWorker(startChargingStation); } else { chargingStationWorker = new ChargingStationWorker(); } diff --git a/src/worker/WorkerConstants.ts b/src/worker/WorkerConstants.ts index bbfcdac4..8c66df02 100644 --- a/src/worker/WorkerConstants.ts +++ b/src/worker/WorkerConstants.ts @@ -10,7 +10,6 @@ export const workerSetVersion = '1.0.1'; export const DEFAULT_ELEMENT_START_DELAY = 0; export const DEFAULT_WORKER_START_DELAY = 500; -export const POOL_MAX_INACTIVE_TIME = 60000; export const DEFAULT_POOL_MIN_SIZE = Math.floor(availableParallelism() / 2); export const DEFAULT_POOL_MAX_SIZE = Math.round(availableParallelism() * 1.5); export const DEFAULT_ELEMENTS_PER_WORKER = 1; diff --git a/src/worker/index.ts b/src/worker/index.ts index e53c3457..a7c3d1ea 100644 --- a/src/worker/index.ts +++ b/src/worker/index.ts @@ -4,7 +4,6 @@ export { DEFAULT_POOL_MAX_SIZE, DEFAULT_POOL_MIN_SIZE, DEFAULT_WORKER_START_DELAY, - POOL_MAX_INACTIVE_TIME, } from './WorkerConstants'; export { WorkerFactory } from './WorkerFactory'; export {