Skip to content

Commit ff9683b

Browse files
author
QTom
committed
fix: move RPM prefetch before routing segment in legacy/mixed paths
Ensures isAccountSchedulableForRPM calls within the routing segment hit the prefetch cache instead of querying Redis individually.
1 parent 6072375 commit ff9683b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

backend/internal/service/gateway_service.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2607,6 +2607,9 @@ func (s *GatewayService) selectAccountForModelWithPlatform(ctx context.Context,
26072607
}
26082608
accountsLoaded = true
26092609

2610+
// 提前预取 RPM 计数,确保 routing 段内的 isAccountSchedulableForRPM 调用能命中缓存
2611+
ctx = s.withRPMPrefetch(ctx, accounts)
2612+
26102613
routingSet := make(map[int64]struct{}, len(routingAccountIDs))
26112614
for _, id := range routingAccountIDs {
26122615
if id > 0 {
@@ -2822,6 +2825,9 @@ func (s *GatewayService) selectAccountWithMixedScheduling(ctx context.Context, g
28222825
}
28232826
accountsLoaded = true
28242827

2828+
// 提前预取 RPM 计数,确保 routing 段内的 isAccountSchedulableForRPM 调用能命中缓存
2829+
ctx = s.withRPMPrefetch(ctx, accounts)
2830+
28252831
routingSet := make(map[int64]struct{}, len(routingAccountIDs))
28262832
for _, id := range routingAccountIDs {
28272833
if id > 0 {

0 commit comments

Comments
 (0)