Type properly station worker data.
[e-mobility-charging-stations-simulator.git] / src / utils / Configuration.ts
index eb1992b3dc33a75a4a063897dfcb48da93ec1132..e27ec1276539a2d7b32decec68ff9f3e6a87e39e 100644 (file)
@@ -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,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 getWorkerMaxPoolSize(): number {
-    return Configuration.getConfig().workerMaxPoolSize;
+  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 {