- protected setRequiredStatistics (opts: WorkerChoiceStrategyOptions): void {
- if (this.requiredStatistics.avgRunTime && opts.medRunTime === true) {
- this.requiredStatistics.avgRunTime = false
- this.requiredStatistics.medRunTime = opts.medRunTime as boolean
- }
- if (this.requiredStatistics.medRunTime && opts.medRunTime === false) {
- this.requiredStatistics.avgRunTime = true
- this.requiredStatistics.medRunTime = opts.medRunTime as boolean
- }
- if (this.requiredStatistics.avgWaitTime && opts.medWaitTime === true) {
- this.requiredStatistics.avgWaitTime = false
- this.requiredStatistics.medWaitTime = opts.medWaitTime as boolean
+ protected setTaskStatisticsRequirements (
+ opts: WorkerChoiceStrategyOptions
+ ): void {
+ this.toggleMedianMeasurementStatisticsRequirements(
+ this.taskStatisticsRequirements.runTime,
+ opts.runTime?.median as boolean
+ )
+ this.toggleMedianMeasurementStatisticsRequirements(
+ this.taskStatisticsRequirements.waitTime,
+ opts.waitTime?.median as boolean
+ )
+ this.toggleMedianMeasurementStatisticsRequirements(
+ this.taskStatisticsRequirements.elu,
+ opts.elu?.median as boolean
+ )
+ }
+
+ private toggleMedianMeasurementStatisticsRequirements (
+ measurementStatisticsRequirements: MeasurementStatisticsRequirements,
+ toggleMedian: boolean
+ ): void {
+ if (measurementStatisticsRequirements.average && toggleMedian) {
+ measurementStatisticsRequirements.average = false
+ measurementStatisticsRequirements.median = toggleMedian