mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
all: use built-in max/min to simplify the code
Change-Id: I309d93d6ebf0feb462217a344d5f02c190220752 Reviewed-on: https://go-review.googlesource.com/c/go/+/661737 Reviewed-by: Sean Liao <sean@liao.dev> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
d584d2b3dd
commit
465097b2b5
@ -730,10 +730,7 @@ func nextTimeout(actual time.Duration) (next time.Duration, ok bool) {
|
||||
// duration by any significant margin. Try the next attempt with an arbitrary
|
||||
// factor above that, so that our growth curve is at least exponential.
|
||||
next = actual * 5 / 4
|
||||
if next > maxDynamicTimeout {
|
||||
return maxDynamicTimeout, true
|
||||
}
|
||||
return next, true
|
||||
return min(next, maxDynamicTimeout), true
|
||||
}
|
||||
|
||||
// There is a very similar copy of this in os/timeout_test.go.
|
||||
|
@ -282,10 +282,7 @@ func nextTimeout(actual time.Duration) (next time.Duration, ok bool) {
|
||||
// duration by any significant margin. Try the next attempt with an arbitrary
|
||||
// factor above that, so that our growth curve is at least exponential.
|
||||
next = actual * 5 / 4
|
||||
if next > maxDynamicTimeout {
|
||||
return maxDynamicTimeout, true
|
||||
}
|
||||
return next, true
|
||||
return min(next, maxDynamicTimeout), true
|
||||
}
|
||||
|
||||
// There is a very similar copy of this in net/timeout_test.go.
|
||||
|
Loading…
x
Reference in New Issue
Block a user