From 0950783479031befd86956867800ac9ac0eb68bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sat, 21 Mar 2026 11:42:49 +0800 Subject: [PATCH] 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. --- service/ccm/service_status.go | 2 +- service/ocm/service_status.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/service/ccm/service_status.go b/service/ccm/service_status.go index 424afa127..41256b7f8 100644 --- a/service/ccm/service_status.go +++ b/service/ccm/service_status.go @@ -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 { diff --git a/service/ocm/service_status.go b/service/ocm/service_status.go index 3e7e2ff65..092209e98 100644 --- a/service/ocm/service_status.go +++ b/service/ocm/service_status.go @@ -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 {