X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Futils%2FConfiguration.ts;h=e27ec1276539a2d7b32decec68ff9f3e6a87e39e;hb=46eb543c2eb31661c078b7e9697dacc593d83e5e;hp=ca98427eb87cee39c22c6a720e5998599e2fbabb;hpb=b3f9c51558e73be4ce7915d6dbcb40f1378ba89e;p=e-mobility-charging-stations-simulator.git diff --git a/src/utils/Configuration.ts b/src/utils/Configuration.ts index ca98427e..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,12 +38,22 @@ 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 getWorkerPoolSize(): number { - return Configuration.getConfig().workerPoolSize; + static getWorkerPoolMinSize(): number { + return Configuration.objectHasOwnProperty(Configuration.getConfig(), 'workerPoolMinSize') ? Configuration.getConfig().workerPoolMinSize : 4; + } + + static getWorkerPoolMaxSize(): number { + Configuration.deprecateConfigurationKey('workerPoolSize;', 'Use \'workerPoolMaxSize\' instead'); + return Configuration.objectHasOwnProperty(Configuration.getConfig(), 'workerPoolMaxSize') ? Configuration.getConfig().workerPoolMaxSize : 16; + } + + static getChargingStationsPerWorker(): number { + return Configuration.objectHasOwnProperty(Configuration.getConfig(), 'chargingStationsPerWorker') ? Configuration.getConfig().chargingStationsPerWorker : 1; } static getLogConsole(): boolean {