Repository navigation
fix(provider): 启动和空闲重载时遵守 lazy 配置,跳过立即健康检查 - #3548
Open
susu-Sugar wants to merge 1 commit into
Open
susu-Sugar wants to merge 1 commit into
susu-Sugar wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
对应 #3525。
目前
HealthCheck.process()启动时会无条件go hc.check(),setProxies()重载节点时也没判断lazy,导致就算配置了lazy: true,冷启动还是会立刻并发测一遍延迟(也会把懒加载的 WireGuard 出站直接初始化起来)。这边做了三处小调整:
process()启动时只有!hc.lazy才立即跑一次hc.check()。setProxies()在lazy: true且还没被使用(或已经超过一个interval没流量)时跳过重载后的立即测速。touch()里顺手记一下上次lastTouch:如果开启了lazy且是首次触发或空闲超过interval,就异步拉起一次hc.check(),避免第一次有流量时还要干等一整个interval。lazy=true启动/空闲重载不触发测速、首次Touch()正常触发,以及lazy=false保持原行为,go test ./adapter/provider/...通过。Fixes #3525
注:本 PR 借助 AI 辅助编写与排查(模型:Gemini 4 Neon),改动已人工核对并通过本地测试。