From 2ceadfe885a91066e44173761b07280e66bd228b Mon Sep 17 00:00:00 2001 From: Kante Yin Date: Wed, 4 Jan 2023 10:49:57 +0800 Subject: [PATCH] Code refactor for readability Signed-off-by: Kante Yin --- pkg/scheduler/framework/runtime/framework.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pkg/scheduler/framework/runtime/framework.go b/pkg/scheduler/framework/runtime/framework.go index 089fcaad4e4..1dbce09ff11 100644 --- a/pkg/scheduler/framework/runtime/framework.go +++ b/pkg/scheduler/framework/runtime/framework.go @@ -730,14 +730,11 @@ func (f *frameworkImpl) RunFilterPlugins( pod *v1.Pod, nodeInfo *framework.NodeInfo, ) *framework.Status { - var status *framework.Status - for _, pl := range f.filterPlugins { if state.SkipFilterPlugins.Has(pl.Name()) { continue } - status = f.runFilterPlugin(ctx, pl, state, pod, nodeInfo) - if !status.IsSuccess() { + if status := f.runFilterPlugin(ctx, pl, state, pod, nodeInfo); !status.IsSuccess() { if !status.IsUnschedulable() { // Filter plugins are not supposed to return any status other than // Success or Unschedulable. @@ -748,7 +745,7 @@ func (f *frameworkImpl) RunFilterPlugins( } } - return status + return nil } func (f *frameworkImpl) runFilterPlugin(ctx context.Context, pl framework.FilterPlugin, state *framework.CycleState, pod *v1.Pod, nodeInfo *framework.NodeInfo) *framework.Status {