A optimization for “RegisterCustomFitPredicate” function, avoiding redundancy
In RegisterCustomFitPredicate, when policy.Argument is nil and fitPredicateMap has the policy.Name, it can return the policy.Name directly. Subsequent operations are redundant.
This commit is contained in:
parent
4513b7c2a4
commit
82009eb5db
@ -121,6 +121,7 @@ func RegisterCustomFitPredicate(policy schedulerapi.PredicatePolicy) string {
|
|||||||
} else if predicateFactory, ok = fitPredicateMap[policy.Name]; ok {
|
} else if predicateFactory, ok = fitPredicateMap[policy.Name]; ok {
|
||||||
// checking to see if a pre-defined predicate is requested
|
// checking to see if a pre-defined predicate is requested
|
||||||
glog.V(2).Infof("Predicate type %s already registered, reusing.", policy.Name)
|
glog.V(2).Infof("Predicate type %s already registered, reusing.", policy.Name)
|
||||||
|
return policy.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
if predicateFactory == nil {
|
if predicateFactory == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user