Merge pull request #120090 from MikeSpreitzer/fix-120032
Handle edge cases in seat demand stats
This commit is contained in:
		@@ -263,9 +263,15 @@ type seatDemandStats struct {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (stats *seatDemandStats) update(obs fq.IntegratorResults) {
 | 
					func (stats *seatDemandStats) update(obs fq.IntegratorResults) {
 | 
				
			||||||
 | 
						stats.highWatermark = obs.Max
 | 
				
			||||||
 | 
						if obs.Duration <= 0 {
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if math.IsNaN(obs.Deviation) {
 | 
				
			||||||
 | 
							obs.Deviation = 0
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	stats.avg = obs.Average
 | 
						stats.avg = obs.Average
 | 
				
			||||||
	stats.stdDev = obs.Deviation
 | 
						stats.stdDev = obs.Deviation
 | 
				
			||||||
	stats.highWatermark = obs.Max
 | 
					 | 
				
			||||||
	envelope := obs.Average + obs.Deviation
 | 
						envelope := obs.Average + obs.Deviation
 | 
				
			||||||
	stats.smoothed = math.Max(envelope, seatDemandSmoothingCoefficient*stats.smoothed+(1-seatDemandSmoothingCoefficient)*envelope)
 | 
						stats.smoothed = math.Max(envelope, seatDemandSmoothingCoefficient*stats.smoothed+(1-seatDemandSmoothingCoefficient)*envelope)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user