Skip to content

feat: Unify account refresh and random retry runtime behavior#494

Merged
chenyme merged 2 commits into
mainfrom
refresh_mode
Apr 20, 2026
Merged

feat: Unify account refresh and random retry runtime behavior#494
chenyme merged 2 commits into
mainfrom
refresh_mode

Conversation

@chenyme

@chenyme chenyme commented Apr 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • 为账户选择链路引入独立的 random 策略:当 account.refresh.enabled=false 时,系统切换到随机选号模式,基于池级冷却和单号并发上限工作,不再依赖额度评分。
  • 将刷新周期与 429 冷却统一为同一组池级配置:account.refresh.basic_interval_secsuper_interval_secheavy_interval_sec,移除独立的 account.random 冷却配置入口与后台配置项。
  • 修正 random 模式下仍会触发 upstream quota probe 的问题,确保自动重试模式不再主动探测额度;同时保留失败记录、401 失效处理和本地状态更新逻辑。
  • 增加 refresh runtime 的热切换能力:更新 account.refresh.enabled 后,当前进程会立即同步 selection strategy 和 refresh scheduler,/admin/api/status 与账户管理页无需重启即可反映最新模式。
  • 同步更新管理后台配置页、账户页和多语言文案,明确 quota / random 两种模式的行为、共享周期含义和运行时展示逻辑。

Testing

  • uv run python -m compileall app/control/account/runtime.py app/control/account/scheduler.py app/main.py app/products/web/admin/__init__.py app/control/account/quota_defaults.py app/control/account/refresh.py app/dataplane/account/__init__.py app/products/openai/chat.py
  • uv run ruff check app/control/account/runtime.py app/control/account/scheduler.py app/main.py app/products/web/admin/__init__.py app/control/account/quota_defaults.py app/control/account/refresh.py app/dataplane/account/__init__.py app/products/openai/chat.py
  • 在隔离进程中做了 runtime smoke check:切换 account.refresh.enabled 后,确认 /admin/api/status 会立即从 random 切到 quota,并同步启动 scheduler。

Related

@chenyme chenyme changed the title Refresh mode feat: Unify account refresh and random retry runtime behavior Apr 20, 2026
@chenyme chenyme merged commit b1c4a36 into main Apr 20, 2026
4 of 5 checks passed
@chenyme chenyme deleted the refresh_mode branch April 21, 2026 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: 增加禁止刷新配额功能

1 participant