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:
世界
2026-03-21 11:42:49 +08:00
parent f172a575b7
commit 0950783479
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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 {
+1 -1
View File
@@ -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 {