}
static getWorkerPoolMinSize(): number {
- return Configuration.objectHasOwnProperty(Configuration.getConfig(), 'workerPoolMinSize') ? Configuration.getConfig().workerPoolMinSize : 4;
+ return Configuration.objectHasOwnProperty(Configuration.getConfig(), 'workerPoolMinSize') ? Configuration.getConfig().workerPoolMinSize : Constants.DEFAULT_WORKER_POOL_MIN_SIZE;
}
static getWorkerPoolMaxSize(): number {
Configuration.deprecateConfigurationKey('workerPoolSize;', 'Use \'workerPoolMaxSize\' instead');
- return Configuration.objectHasOwnProperty(Configuration.getConfig(), 'workerPoolMaxSize') ? Configuration.getConfig().workerPoolMaxSize : 16;
+ return Configuration.objectHasOwnProperty(Configuration.getConfig(), 'workerPoolMaxSize') ? Configuration.getConfig().workerPoolMaxSize : Constants.DEFAULT_WORKER_POOL_MAX_SIZE;
}
static getWorkerPoolStrategy(): WorkerChoiceStrategy {
}
static getChargingStationsPerWorker(): number {
- return Configuration.objectHasOwnProperty(Configuration.getConfig(), 'chargingStationsPerWorker') ? Configuration.getConfig().chargingStationsPerWorker : 1;
+ return Configuration.objectHasOwnProperty(Configuration.getConfig(), 'chargingStationsPerWorker') ? Configuration.getConfig().chargingStationsPerWorker : Constants.DEFAULT_CHARGING_STATIONS_PER_WORKER;
}
static getLogConsole(): boolean {
static readonly WORKER_START_DELAY = 500;
static readonly WORKER_POOL_MAX_INACTIVE_TIME = 60000;
+ static readonly DEFAULT_WORKER_POOL_MIN_SIZE = 4;
+ static readonly DEFAULT_WORKER_POOL_MAX_SIZE = 16;
+ static readonly DEFAULT_CHARGING_STATIONS_PER_WORKER = 1;
}
options.startDelay = options.startDelay ?? Constants.WORKER_START_DELAY;
switch (workerProcessType) {
case WorkerProcessType.WORKER_SET:
- options.elementsPerWorker = options.elementsPerWorker ?? 1;
+ options.elementsPerWorker = options.elementsPerWorker ?? Constants.DEFAULT_CHARGING_STATIONS_PER_WORKER;
return new WorkerSet<T>(workerScript, options.elementsPerWorker, options.startDelay);
case WorkerProcessType.STATIC_POOL:
- options.poolMaxSize = options.poolMaxSize ?? 16;
+ options.poolMaxSize = options.poolMaxSize ?? Constants.DEFAULT_WORKER_POOL_MAX_SIZE;
return new WorkerStaticPool<T>(workerScript, options.poolMaxSize, options.startDelay, options.poolOptions);
case WorkerProcessType.DYNAMIC_POOL:
- options.poolMinSize = options.poolMinSize ?? 4;
- options.poolMaxSize = options.poolMaxSize ?? 16;
+ options.poolMinSize = options.poolMinSize ?? Constants.DEFAULT_WORKER_POOL_MIN_SIZE;
+ options.poolMaxSize = options.poolMaxSize ?? Constants.DEFAULT_WORKER_POOL_MAX_SIZE;
return new WorkerDynamicPool<T>(workerScript, options.poolMinSize, options.poolMaxSize, options.startDelay, options.poolOptions);
default:
return null;