From 65f3454c1d926a1f119710684794bb54350ef4b1 Mon Sep 17 00:00:00 2001 From: RuquanZhao Date: Thu, 20 Apr 2023 17:16:46 +0800 Subject: [PATCH] fix undefined convertion Signed-off-by: Ruquan Zhao ruquan.zhao@arm.com --- .../pkg/util/flowcontrol/fairqueuing/queueset/queueset_test.go | 2 +- .../apiserver/pkg/util/flowcontrol/request/seat_seconds.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/queueset/queueset_test.go b/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/queueset/queueset_test.go index e456b0efdf6..1680bfb4293 100644 --- a/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/queueset/queueset_test.go +++ b/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/queueset/queueset_test.go @@ -724,7 +724,7 @@ func TestDifferentFlowsExpectEqual(t *testing.T) { }.exercise(t) } -// TestSeatSecondsRollover checks that there is not a problem with SeatSecons overflow. +// TestSeatSecondsRollover checks that there is not a problem with SeatSeconds overflow. func TestSeatSecondsRollover(t *testing.T) { metrics.Register() now := time.Now() diff --git a/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/request/seat_seconds.go b/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/request/seat_seconds.go index e3a40174524..05dab65bdd3 100644 --- a/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/request/seat_seconds.go +++ b/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/request/seat_seconds.go @@ -38,7 +38,7 @@ const MinSeatSeconds = SeatSeconds(0) // This is intended only to produce small values, increments in work // rather than amount of work done since process start. func SeatsTimesDuration(seats float64, duration time.Duration) SeatSeconds { - return SeatSeconds(math.Round(seats * float64(duration/time.Nanosecond) / (1e9 / ssScale))) + return SeatSeconds(int64(math.Round(seats * float64(duration/time.Nanosecond) / (1e9 / ssScale)))) } // ToFloat converts to a floating-point representation.