+ static getWorker(): WorkerConfiguration {
+ Configuration.warnDeprecatedConfigurationKey(
+ 'useWorkerPool',
+ null,
+ "Use 'worker' section to define the type of worker process model instead"
+ );
+ Configuration.warnDeprecatedConfigurationKey(
+ 'workerProcess',
+ null,
+ "Use 'worker' section to define the type of worker process model instead"
+ );
+ Configuration.warnDeprecatedConfigurationKey(
+ 'workerStartDelay',
+ null,
+ "Use 'worker' section to define the worker start delay instead"
+ );
+ Configuration.warnDeprecatedConfigurationKey(
+ 'chargingStationsPerWorker',
+ null,
+ "Use 'worker' section to define the number of element(s) per worker instead"
+ );
+ Configuration.warnDeprecatedConfigurationKey(
+ 'elementStartDelay',
+ null,
+ "Use 'worker' section to define the worker's element start delay instead"
+ );
+ Configuration.warnDeprecatedConfigurationKey(
+ 'workerPoolMinSize',
+ null,
+ "Use 'worker' section to define the worker pool minimum size instead"
+ );
+ Configuration.warnDeprecatedConfigurationKey(
+ 'workerPoolSize;',
+ null,
+ "Use 'worker' section to define the worker pool maximum size instead"
+ );
+ Configuration.warnDeprecatedConfigurationKey(
+ 'workerPoolMaxSize;',
+ null,
+ "Use 'worker' section to define the worker pool maximum size instead"
+ );
+ Configuration.warnDeprecatedConfigurationKey(
+ 'workerPoolStrategy;',
+ null,
+ "Use 'worker' section to define the worker pool strategy instead"
+ );
+ let workerConfiguration: WorkerConfiguration = {
+ processType: Configuration.objectHasOwnProperty(Configuration.getConfig(), 'workerProcess')
+ ? Configuration.getConfig().workerProcess
+ : WorkerProcessType.WORKER_SET,
+ startDelay: Configuration.objectHasOwnProperty(Configuration.getConfig(), 'workerStartDelay')
+ ? Configuration.getConfig().workerStartDelay
+ : WorkerConstants.DEFAULT_WORKER_START_DELAY,
+ elementsPerWorker: Configuration.objectHasOwnProperty(
+ Configuration.getConfig(),
+ 'chargingStationsPerWorker'
+ )
+ ? Configuration.getConfig().chargingStationsPerWorker
+ : WorkerConstants.DEFAULT_ELEMENTS_PER_WORKER,
+ elementStartDelay: Configuration.objectHasOwnProperty(
+ Configuration.getConfig(),
+ 'elementStartDelay'
+ )
+ ? Configuration.getConfig().elementStartDelay
+ : WorkerConstants.DEFAULT_ELEMENT_START_DELAY,
+ poolMinSize: Configuration.objectHasOwnProperty(
+ Configuration.getConfig(),
+ 'workerPoolMinSize'
+ )
+ ? Configuration.getConfig().workerPoolMinSize
+ : WorkerConstants.DEFAULT_POOL_MIN_SIZE,
+ poolMaxSize: Configuration.objectHasOwnProperty(
+ Configuration.getConfig(),
+ 'workerPoolMaxSize'
+ )
+ ? Configuration.getConfig().workerPoolMaxSize
+ : WorkerConstants.DEFAULT_POOL_MAX_SIZE,
+ poolStrategy: Configuration.getConfig().workerPoolStrategy,
+ };
+ if (Configuration.objectHasOwnProperty(Configuration.getConfig(), 'worker')) {
+ workerConfiguration = { ...workerConfiguration, ...Configuration.getConfig().worker };
+ }
+ return workerConfiguration;