修复更新节点时并发导致的分配失败问题

This commit is contained in:
2025-08-16 18:38:29 +08:00
parent 83f112c260
commit b6731f8442
3 changed files with 9 additions and 16 deletions

View File

@@ -94,6 +94,14 @@ func Update(args ...UpdateArgs) error {
if err != nil {
return fmt.Errorf("查询城市 %s 可用节点失败:%w", city.Name, err)
}
if len(edges) < count {
slog.Debug("城市节点不足,将循环使用节点", "城市", city.Name, "节点数", city.EdgesCount, "网关数", count)
edges, err = SliceActiveEdgesByCity(tx, city.Id, 0, count)
if err != nil {
return fmt.Errorf("查询城市 %s 可用节点失败:%w", city.Name, err)
}
offset = 0
}
// 更新网关配置
var configs2Create []model.Config