修复更新节点时并发导致的分配失败问题
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user