fix: stop dropping tolerance when converting a group to Smart (#2112)

The Smart override converts url-test and load-balance groups and then
strips their type-specific keys. tolerance is in that list, but the Smart
core supports it: SmartOption.Tolerance feeds the sort comparator, where
delays within tolerance compare equal so the group stops flapping between
nodes of near-identical latency.

Because a normal override always runs before the Smart one, this leaves no
way to set tolerance at all while the auto override is on - a value in the
subscription is deleted, and so is one set by an earlier override. The
branch that handles an already-smart group never deleted it, so the two
paths disagreed.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
MOMO0302-02
2026-09-17 17:03:33 -07:00
committed by GitHub
parent ac1bb9ef78
commit 3b42348c6d

View File

@@ -86,10 +86,9 @@ function main(config) {
group.uselightgbm = ${useLightGBM}
group.collectdata = ${collectData}
// 移除 url-test 和 load-balance 特有的配置
// 移除 url-test 和 load-balance 特有的配置tolerance 是 Smart 也支持的选项,保留)
if (group.url) delete group.url
if (group.interval) delete group.interval
if (group.tolerance) delete group.tolerance
if (group.lazy) delete group.lazy
if (group.expected_status) delete group['expected-status']
}