refactor: cleanup package.json version usage
[e-mobility-charging-stations-simulator.git] / src / worker / WorkerConstants.ts
index 635bfe529a82c79deba2ac60f6486a6c1672396b..4e0bce1f86dca990f99be28649b0dafe50620488 100644 (file)
@@ -1,3 +1,5 @@
+import { availableParallelism } from 'poolifier';
+
 export class WorkerConstants {
   public static readonly EMPTY_FUNCTION = Object.freeze(() => {
     /* This is intentional */
@@ -6,10 +8,12 @@ export class WorkerConstants {
   public static readonly DEFAULT_ELEMENT_START_DELAY = 0;
   public static readonly DEFAULT_WORKER_START_DELAY = 500;
   public static readonly POOL_MAX_INACTIVE_TIME = 60000;
-  public static readonly DEFAULT_POOL_MIN_SIZE = 4;
-  public static readonly DEFAULT_POOL_MAX_SIZE = 16;
+  public static readonly DEFAULT_POOL_MIN_SIZE = availableParallelism() / 2;
+  public static readonly DEFAULT_POOL_MAX_SIZE = availableParallelism();
   public static readonly DEFAULT_ELEMENTS_PER_WORKER = 1;
 
+  public static readonly version = '1.0.0';
+
   private constructor() {
     // This is intentional
   }