renaming (pool size != max pool size)
authorJakob <jakob-ingenfeld@gmx.de>
Thu, 21 Jan 2021 14:59:25 +0000 (15:59 +0100)
committerJakob <jakob-ingenfeld@gmx.de>
Thu, 21 Jan 2021 14:59:25 +0000 (15:59 +0100)
docker/config.json
src/assets/config-template.json
src/charging-station/Worker.ts
src/types/ConfigurationData.ts
src/utils/Configuration.ts

index edd0da85f48f30bd2f2b7ef2054e8d5325b25808..84148c20d9438eb34e9d65522ac8b216869df7ca 100644 (file)
@@ -5,7 +5,8 @@
   "distributeStationsToTenantsEqually": true,
   "statisticsDisplayInterval": 60,
   "useWorkerPool": false,
-  "workerPoolSize": 16,
+  "workerMaxPoolSize": 16,
+  "chargingStationsPerWorker": 1,
   "stationTemplateURLs": [
     {
       "file": "./src/assets/station-templates/siemens.station-template.json",
index bfa96ecca108561810f8f00e5d760364c1f65e30..e6ea2f33896cb58023d30f58b7d563d33650f34a 100644 (file)
@@ -5,7 +5,7 @@
   "distributeStationsToTenantsEqually": true,
   "statisticsDisplayInterval": 60,
   "useWorkerPool": false,
-  "workerPoolSize": 16,
+  "workerMaxPoolSize": 16,
   "chargingStationsPerWorker": 1,
   "stationTemplateURLs": [
     {
index efa327fd8a0666d301bfcae95d8b332a79158958..66e21329f804f703542b98ba04101d1604935777 100644 (file)
@@ -20,7 +20,7 @@ export default class Wrk {
     this._workerData = workerData;
     this._workerScript = workerScript;
     if (Configuration.useWorkerPool()) {
-      WorkerPool.maxConcurrentWorkers = Configuration.getWorkerPoolSize();
+      WorkerPool.maxConcurrentWorkers = Configuration.getWorkerMaxPoolSize();
     }
   }
 
@@ -88,8 +88,18 @@ export default class Wrk {
       this._worker = worker;
     });
   }
+
+  /**
+   *
+   * @return {number}
+   * @public
+   */
+  public getPoolSize(): number {
+    return WorkerPool.getPoolSize();
+  }
 }
 
+
 class WorkerPool {
   public static maxConcurrentWorkers: number;
   private static _instance: Pool;
@@ -106,4 +116,8 @@ class WorkerPool {
   public static acquire(filename: string, options: WorkerOptions, callback: (error: Error | null, worker: Worker) => void): void {
     WorkerPool.getInstance().acquire(filename, options, callback);
   }
+
+  public static getPoolSize(): number {
+    return WorkerPool._instance.size;
+  }
 }
index bc4e0f8846225ffb7547d216e21bb05c340ddf5a..604e249bd37b4ad1b6dbbaabe1dff3e901b44f41 100644 (file)
@@ -11,7 +11,7 @@ export default interface ConfigurationData {
   autoReconnectMaxRetries?: number;
   distributeStationsToTenantsEqually?: boolean;
   useWorkerPool?: boolean;
-  workerPoolSize?: number;
+  workerMaxPoolSize?: number;
   chargingStationsPerWorker?: number;
   logFormat?: string;
   logLevel?: string;
index 3e2a66bcaa266a136a9a82248ec466c5f3a7d583..eb1992b3dc33a75a4a063897dfcb48da93ec1132 100644 (file)
@@ -41,8 +41,8 @@ export default class Configuration {
     return Configuration.getConfig().useWorkerPool;
   }
 
-  static getWorkerPoolSize(): number {
-    return Configuration.getConfig().workerPoolSize;
+  static getWorkerMaxPoolSize(): number {
+    return Configuration.getConfig().workerMaxPoolSize;
   }
 
   static getChargingStationsPerWorker(): number {