X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fworker%2FWorkerConstants.ts;h=dcbe2ca43caa3faec645c6e693dc04f1cb8b93f2;hb=81b9a105a722ddb59ceaec77f9131695d80be495;hp=635bfe529a82c79deba2ac60f6486a6c1672396b;hpb=ceec2441596cccd7bc5249721cd9ac8487cb920f;p=e-mobility-charging-stations-simulator.git diff --git a/src/worker/WorkerConstants.ts b/src/worker/WorkerConstants.ts index 635bfe52..dcbe2ca4 100644 --- a/src/worker/WorkerConstants.ts +++ b/src/worker/WorkerConstants.ts @@ -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 = Math.floor(availableParallelism() / 2); + public static readonly DEFAULT_POOL_MAX_SIZE = Math.round(availableParallelism() * 1.5); public static readonly DEFAULT_ELEMENTS_PER_WORKER = 1; + public static readonly version = '1.0.1'; + private constructor() { // This is intentional }