fix(ccm,ocm): exclude unusable credentials from status aggregation
computeAggregatedUtilization used isAvailable() which only checks permanent unavailability, so credentials rejected by upstream 400 still had their planWeight included in the total, inflating reported capacity and diluting utilization.
This commit is contained in:
@@ -176,7 +176,7 @@ func (s *Service) computeAggregatedUtilization(provider credentialProvider, user
|
||||
var totalWeightedHoursUntil5hReset, total5hResetWeight float64
|
||||
var totalWeightedHoursUntilWeeklyReset, totalWeeklyResetWeight float64
|
||||
for _, credential := range provider.allCredentials() {
|
||||
if !credential.isAvailable() {
|
||||
if !credential.isUsable() {
|
||||
continue
|
||||
}
|
||||
if userConfig != nil && userConfig.ExternalCredential != "" && credential.tagName() == userConfig.ExternalCredential {
|
||||
|
||||
@@ -176,7 +176,7 @@ func (s *Service) computeAggregatedUtilization(provider credentialProvider, user
|
||||
var totalWeightedHoursUntil5hReset, total5hResetWeight float64
|
||||
var totalWeightedHoursUntilWeeklyReset, totalWeeklyResetWeight float64
|
||||
for _, credential := range provider.allCredentials() {
|
||||
if !credential.isAvailable() {
|
||||
if !credential.isUsable() {
|
||||
continue
|
||||
}
|
||||
if userConfig != nil && userConfig.ExternalCredential != "" && credential.tagName() == userConfig.ExternalCredential {
|
||||
|
||||
Reference in New Issue
Block a user