Cleanup workers handling classes.
[e-mobility-charging-stations-simulator.git] / src / utils / Configuration.ts
index 760695253531f6c64863315287eb36063895b5a7..8770a9b9f3ec48cf5859d52b8a2383585a4b8351 100644 (file)
@@ -41,8 +41,13 @@ export default class Configuration {
     return Configuration.getConfig().useWorkerPool;
   }
 
-  static getWorkerPoolSize(): number {
-    return Configuration.getConfig().workerPoolSize;
+  static getWorkerPoolMaxSize(): number {
+    Configuration.deprecateConfigurationKey('workerPoolSize;', 'Use \'workerPoolMaxSize\' instead');
+    return Configuration.useWorkerPool() && 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 {
@@ -100,7 +105,7 @@ export default class Configuration {
   }
 
   private static objectHasOwnProperty(object: any, property: string): boolean {
-    return Object.prototype.hasOwnProperty.call(object, property);
+    return Object.prototype.hasOwnProperty.call(object, property) as boolean;
   }
 
   private static isUndefined(obj: any): boolean {