Skip to content

fix(auth): respect configured auto-refresh interval#1685

Merged
luispater merged 1 commit intorouter-for-me:devfrom
lyd123qw2008:fix/auth-auto-refresh-interval
Feb 24, 2026
Merged

fix(auth): respect configured auto-refresh interval#1685
luispater merged 1 commit intorouter-for-me:devfrom
lyd123qw2008:fix/auth-auto-refresh-interval

Conversation

@lyd123qw2008
Copy link
Contributor

Description

  • 修复 StartAutoRefresh 将传入 interval 强制覆盖为 refreshCheckInterval 的问题。
  • 变更后仅在 interval <= 0 时回退到默认 refreshCheckInterval,否则使用调用方传入值(例如 15m)。

Why

  • 当前实现导致 auto-refresh 实际固定 5 秒检查一次。
  • 在大量 auth 文件场景下,会放大 refresh 调度频率和系统负载。

Scope

  • 单文件、单逻辑点修改:
    • sdk/cliproxy/auth/conductor.go

Diff summary

  • Before:
    • 无论传入什么间隔,都变成 5 秒。
  • After:
    • 仅当传入值无效时使用 5 秒默认值;有效值保留。

Verification

  1. 容器构建通过
    • docker compose build cli-proxy-api
  2. 定向测试通过
    • go test ./sdk/cliproxy/auth(容器内)
  3. 全量测试现状
    • go test ./... 失败点在已有 thinking e2e 用例,与本 PR 无关。

Risk

  • 低风险,未改刷新判定、重试、并发逻辑,仅修复 interval 赋值错误。

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @lyd123qw2008, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求旨在优化认证模块中的自动刷新机制。通过修正一个逻辑错误,确保了用户自定义的刷新间隔能够被正确采纳,而非总是被固定为默认值。这一改进避免了在大量认证文件场景下可能出现的过度刷新调度和系统负载增加,从而提升了系统的稳定性和效率。

Highlights

  • 修复自动刷新间隔: 解决了 StartAutoRefresh 函数中,传入的自动刷新间隔 interval 被强制覆盖为默认值 refreshCheckInterval 的问题。现在,只有当传入的 interval 小于等于0时,才会回退到默认值,否则将使用调用方指定的值。

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • sdk/cliproxy/auth/conductor.go
    • 修正了 StartAutoRefresh 函数中自动刷新间隔的设置逻辑。
Activity
  • 此拉取请求自创建以来,尚未有任何人工活动(例如评论或审查)。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

这个 PR 修复了 StartAutoRefresh 函数中自动刷新间隔被强制覆盖为默认值的问题。之前的代码逻辑有误,无论传入的 interval 是多少,都会被设置为 refreshCheckInterval (5秒)。修改后的代码只在 interval 小于等于0时才使用默认值,否则会采用调用方传入的有效间隔。这个修复是正确的,解决了高负载下因刷新过于频繁导致的问题,并且代码简洁明了。

@luispater luispater changed the base branch from main to dev February 24, 2026 17:13
@luispater luispater merged commit aa1da8a into router-for-me:dev Feb 24, 2026
2 checks passed
AoaoMH pushed a commit to AoaoMH/CLIProxyAPI-Aoao that referenced this pull request Mar 3, 2026
…-refresh-interval

fix(auth): respect configured auto-refresh interval
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.

2 participants