From 3ed4dd661d1a4d8b644a13dfdd44b4455c6250d4 Mon Sep 17 00:00:00 2001 From: bogo_y Date: Mon, 30 Dec 2024 18:21:23 +0800 Subject: [PATCH] use max func to simplify code of capacity plugin Signed-off-by: bogo_y --- pkg/scheduler/plugins/capacity/capacity.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/scheduler/plugins/capacity/capacity.go b/pkg/scheduler/plugins/capacity/capacity.go index 24466a272a..5344c3c1ea 100644 --- a/pkg/scheduler/plugins/capacity/capacity.go +++ b/pkg/scheduler/plugins/capacity/capacity.go @@ -697,10 +697,7 @@ func (cp *capacityPlugin) updateShare(attr *queueAttr) { res := float64(0) for _, rn := range attr.deserved.ResourceNames() { - share := helpers.Share(attr.allocated.Get(rn), attr.deserved.Get(rn)) - if share > res { - res = share - } + res = max(res, helpers.Share(attr.allocated.Get(rn), attr.deserved.Get(rn))) } attr.share = res