Merge pull request #122310 from weilaaa/use_buildin_max_min_instead

use build-in max and min func to instead of k8s.io/utils/integer funcs

Kubernetes-commit: 2b5c0c281d7d3b75ed7df683f09339147c4a17e9
This commit is contained in:
Kubernetes Publisher 2023-12-18 19:25:34 +01:00
commit 0a514be22c
3 changed files with 5 additions and 6 deletions

4
go.mod
View File

@ -24,7 +24,7 @@ require (
golang.org/x/term v0.13.0
golang.org/x/time v0.3.0
google.golang.org/protobuf v1.31.0
k8s.io/api v0.0.0-20231214051658-d7980a488dca
k8s.io/api v0.0.0-20231218211704-fa9b0f032aab
k8s.io/apimachinery v0.0.0-20231214011457-e2f405af78de
k8s.io/klog/v2 v2.110.1
k8s.io/kube-openapi v0.0.0-20231113174909-778a5567bc1e
@ -61,6 +61,6 @@ require (
)
replace (
k8s.io/api => k8s.io/api v0.0.0-20231214051658-d7980a488dca
k8s.io/api => k8s.io/api v0.0.0-20231218211704-fa9b0f032aab
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20231214011457-e2f405af78de
)

4
go.sum
View File

@ -157,8 +157,8 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.0.0-20231214051658-d7980a488dca h1:Urrc4jYo/WprZDMqVX0HkKvq8zuZ9LgIogF5A+T2VjQ=
k8s.io/api v0.0.0-20231214051658-d7980a488dca/go.mod h1:3qapnEMm0F6dC2quMZEkgRdY1XZO9qCO3VJfYdAZMhg=
k8s.io/api v0.0.0-20231218211704-fa9b0f032aab h1:pLXSv38simFZcg/4cgOv9APOSfGPb8nosA11RQNgzBE=
k8s.io/api v0.0.0-20231218211704-fa9b0f032aab/go.mod h1:3qapnEMm0F6dC2quMZEkgRdY1XZO9qCO3VJfYdAZMhg=
k8s.io/apimachinery v0.0.0-20231214011457-e2f405af78de h1:gOF2Xlsae9C8Cp7Te7Pxw2D0i4m8ddqrsX8lAvfsOrE=
k8s.io/apimachinery v0.0.0-20231214011457-e2f405af78de/go.mod h1:djf1C8dGXS7Htg00o2kMGnUD7h6rmK/5k36U8AzZRSw=
k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0=

View File

@ -23,7 +23,6 @@ import (
"k8s.io/utils/clock"
testingclock "k8s.io/utils/clock/testing"
"k8s.io/utils/integer"
)
type backoffEntry struct {
@ -100,7 +99,7 @@ func (p *Backoff) Next(id string, eventTime time.Time) {
} else {
delay := entry.backoff * 2 // exponential
delay += p.jitter(entry.backoff) // add some jitter to the delay
entry.backoff = time.Duration(integer.Int64Min(int64(delay), int64(p.maxDuration)))
entry.backoff = min(delay, p.maxDuration)
}
entry.lastUpdate = p.Clock.Now()
}