Change average from int to int64 in order to support 32-bit systems. (#4921)

master
Andrej Pregl 7 years ago committed by Dee Koder
parent 3e632a49ee
commit f45e0a44b8
  1. 6
      cmd/dynamic-timeouts.go

@ -88,16 +88,16 @@ func (dt *dynamicTimeout) logEntry(duration time.Duration) {
// previous results
func (dt *dynamicTimeout) adjust(entries [dynamicTimeoutLogSize]time.Duration) {
failures, average := 0, 0
failures, average := 0, int64(0)
for i := 0; i < len(entries); i++ {
if entries[i] == maxDuration {
failures++
} else {
average += int(entries[i])
average += int64(entries[i])
}
}
if failures < len(entries) {
average /= len(entries) - failures
average /= int64(len(entries) - failures)
}
timeOutHitPct := float64(failures) / float64(len(entries))

Loading…
Cancel
Save