X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Futils%2FConfiguration.ts;h=e27ec1276539a2d7b32decec68ff9f3e6a87e39e;hb=46eb543c2eb31661c078b7e9697dacc593d83e5e;hp=8770a9b9f3ec48cf5859d52b8a2383585a4b8351;hpb=955a7d92aacad31127ceb5f9ff7fcc031f3d092d;p=e-mobility-charging-stations-simulator.git diff --git a/src/utils/Configuration.ts b/src/utils/Configuration.ts index 8770a9b9..e27ec127 100644 --- a/src/utils/Configuration.ts +++ b/src/utils/Configuration.ts @@ -1,5 +1,6 @@ import ConfigurationData, { StationTemplateURL } from '../types/ConfigurationData'; +import { WorkerProcessType } from '../types/Worker'; import fs from 'fs'; export default class Configuration { @@ -37,13 +38,18 @@ export default class Configuration { return Configuration.getConfig().stationTemplateURLs; } - static useWorkerPool(): boolean { - return Configuration.getConfig().useWorkerPool; + static getWorkerProcess(): WorkerProcessType { + Configuration.deprecateConfigurationKey('useWorkerPool;', 'Use \'workerProcess\' to define the type of worker process to use instead'); + return Configuration.objectHasOwnProperty(Configuration.getConfig(), 'workerProcess') ? Configuration.getConfig().workerProcess : WorkerProcessType.WORKER_SET; + } + + static getWorkerPoolMinSize(): number { + return Configuration.objectHasOwnProperty(Configuration.getConfig(), 'workerPoolMinSize') ? Configuration.getConfig().workerPoolMinSize : 4; } static getWorkerPoolMaxSize(): number { Configuration.deprecateConfigurationKey('workerPoolSize;', 'Use \'workerPoolMaxSize\' instead'); - return Configuration.useWorkerPool() && Configuration.objectHasOwnProperty(Configuration.getConfig(), 'workerPoolMaxSize') ? Configuration.getConfig().workerPoolMaxSize : 16; + return Configuration.objectHasOwnProperty(Configuration.getConfig(), 'workerPoolMaxSize') ? Configuration.getConfig().workerPoolMaxSize : 16; } static getChargingStationsPerWorker(): number {