Commit ff9683b0 authored by QTom's avatar QTom
Browse files

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.
parent 60723757
...@@ -2607,6 +2607,9 @@ func (s *GatewayService) selectAccountForModelWithPlatform(ctx context.Context, ...@@ -2607,6 +2607,9 @@ func (s *GatewayService) selectAccountForModelWithPlatform(ctx context.Context,
} }
accountsLoaded = true accountsLoaded = true
// 提前预取 RPM 计数,确保 routing 段内的 isAccountSchedulableForRPM 调用能命中缓存
ctx = s.withRPMPrefetch(ctx, accounts)
routingSet := make(map[int64]struct{}, len(routingAccountIDs)) routingSet := make(map[int64]struct{}, len(routingAccountIDs))
for _, id := range routingAccountIDs { for _, id := range routingAccountIDs {
if id > 0 { if id > 0 {
...@@ -2822,6 +2825,9 @@ func (s *GatewayService) selectAccountWithMixedScheduling(ctx context.Context, g ...@@ -2822,6 +2825,9 @@ func (s *GatewayService) selectAccountWithMixedScheduling(ctx context.Context, g
} }
accountsLoaded = true accountsLoaded = true
// 提前预取 RPM 计数,确保 routing 段内的 isAccountSchedulableForRPM 调用能命中缓存
ctx = s.withRPMPrefetch(ctx, accounts)
routingSet := make(map[int64]struct{}, len(routingAccountIDs)) routingSet := make(map[int64]struct{}, len(routingAccountIDs))
for _, id := range routingAccountIDs { for _, id := range routingAccountIDs {
if id > 0 { if id > 0 {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment