// exceedStoreLimitLocked returns true if the store exceeds the cost limit after adding the operator. Otherwise, returns false.
func (oc *OperatorController) exceedStoreLimitLocked(ops ...*operator.Operator) bool {
opInfluence := NewTotalOpInfluence(ops, oc.cluster)
for storeID := range opInfluence.StoresInfluence {
for _, v := range storelimit.TypeNameValue {
stepCost := opInfluence.GetStoreInfluence(storeID).GetStepCost(v)
if stepCost == 0 {
continue
}
limiter := oc.getOrCreateStoreLimit(storeID, v)
if limiter == nil {
return false
}
if limiter.Available() < stepCost {
return true
}
}
}
return false
}
l have some question about this code,why return false when limiter is nil,maybe use continue
will be better