fix: address audit findings - cache sync, validation, consistency

- clearCreditsExhausted: sync Redis scheduler cache after DB update
- Image billing mode UI: write to per_request_price instead of image_output_price
- OpenAI RecordUsage: use BillingModelSourceRequested constant, add s.cfg nil guard
- Fix i18n key path: admin.channels.perRequestPriceRequired → admin.channels.form.perRequestPriceRequired
This commit is contained in:
erio
2026-04-01 23:13:58 +08:00
parent 5534347328
commit 9b213115e7
4 changed files with 12 additions and 5 deletions

View File

@@ -140,6 +140,10 @@ func (s *AntigravityGatewayService) clearCreditsExhausted(ctx context.Context, a
}); err != nil {
logger.LegacyPrintf("service.antigravity_gateway", "clear credits exhausted failed: account=%d err=%v", account.ID, err)
}
// 同步更新 Redis 调度快照,避免其他节点/请求延迟感知
if s.schedulerSnapshot != nil {
_ = s.schedulerSnapshot.UpdateAccountInCache(ctx, account)
}
}
// classifyAntigravity429 将 Antigravity 的 429 响应归类为配额耗尽、限流或未知。