Skip to content

Commit

Permalink
avoid negative time normalized values
Browse files Browse the repository at this point in the history
  • Loading branch information
vbauerster committed Aug 20, 2024
1 parent 67adb9c commit 2ae65d2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions decor/eta.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ func MaxTolerateTimeNormalizer(maxTolerate time.Duration) TimeNormalizer {
}
normalized -= time.Since(lastCall)
lastCall = time.Now()
return normalized
if normalized > 0 {
return normalized
}
return remaining
})
}

Expand All @@ -183,7 +186,10 @@ func FixedIntervalTimeNormalizer(updInterval int) TimeNormalizer {
count--
normalized -= time.Since(lastCall)
lastCall = time.Now()
return normalized
if normalized > 0 {
return normalized
}
return remaining
})
}

Expand Down

0 comments on commit 2ae65d2

Please sign in to comment.