X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fworker%2FWorkerConstants.ts;h=e7572db3d5cc2eb92ff4b1a4238dc1447e7a1a25;hb=f26233c0fd267bc2ef00636ca7531a0877bb5dbe;hp=12bb70accb53f170137313da6f1abc8d43cd8f68;hpb=59b6ed8d1db313ef3371efd8ab5e039cf3dedab0;p=e-mobility-charging-stations-simulator.git diff --git a/src/worker/WorkerConstants.ts b/src/worker/WorkerConstants.ts index 12bb70ac..e7572db3 100644 --- a/src/worker/WorkerConstants.ts +++ b/src/worker/WorkerConstants.ts @@ -1,15 +1,18 @@ +import { availableParallelism } from 'poolifier'; + export class WorkerConstants { - public static EMPTY_OBJECT = {}; public static readonly EMPTY_FUNCTION = Object.freeze(() => { /* This is intentional */ }); - static readonly DEFAULT_ELEMENT_START_DELAY = 0; - static readonly DEFAULT_WORKER_START_DELAY = 500; - static readonly POOL_MAX_INACTIVE_TIME = 60000; - static readonly DEFAULT_POOL_MIN_SIZE = 4; - static readonly DEFAULT_POOL_MAX_SIZE = 16; - static readonly DEFAULT_ELEMENTS_PER_WORKER = 1; + 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 = Math.floor(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