修复一个导致边缘节点信息更新不完全的问题
This commit is contained in:
@@ -1,7 +1,11 @@
|
|||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
|
### 长期
|
||||||
|
|
||||||
模型字段修改,特定枚举字段使用自定义类型代替通用 int32
|
模型字段修改,特定枚举字段使用自定义类型代替通用 int32
|
||||||
|
|
||||||
|
更新接口可以传输更结构化的数据,直接区分不同类型以加快更新速度
|
||||||
|
|
||||||
## 业务逻辑
|
## 业务逻辑
|
||||||
|
|
||||||
### 代理服务与节点的增量更新
|
### 代理服务与节点的增量更新
|
||||||
|
|||||||
@@ -217,12 +217,6 @@ func ProxyReportUpdate(c *fiber.Ctx) (err error) {
|
|||||||
var otherEdges = make([]*ProxyEdge, 0, len(req.Edges))
|
var otherEdges = make([]*ProxyEdge, 0, len(req.Edges))
|
||||||
for _, edge := range req.Edges {
|
for _, edge := range req.Edges {
|
||||||
|
|
||||||
// 跳过不方便批量操作的边缘节点
|
|
||||||
if edge.Port != nil || edge.Prov != nil || edge.City != nil {
|
|
||||||
otherEdges = append(otherEdges, edge)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查更新ISP
|
// 检查更新ISP
|
||||||
if edge.Isp != nil {
|
if edge.Isp != nil {
|
||||||
switch edge2.ISPFromStr(*edge.Isp) {
|
switch edge2.ISPFromStr(*edge.Isp) {
|
||||||
@@ -245,15 +239,21 @@ func ProxyReportUpdate(c *fiber.Ctx) (err error) {
|
|||||||
idsInactive = append(idsInactive, edge.Id)
|
idsInactive = append(idsInactive, edge.Id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 无法分类更新
|
||||||
|
if edge.Host != nil || edge.Port != nil || edge.Prov != nil || edge.City != nil {
|
||||||
|
otherEdges = append(otherEdges, edge)
|
||||||
|
continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
slog.Debug("更新边缘节点信息",
|
slog.Debug("更新边缘节点信息",
|
||||||
"active", len(idsActive),
|
"active", len(idsActive),
|
||||||
"inactive", len(idsInactive),
|
"inactive", len(idsInactive),
|
||||||
"isp_unknown", len(idsIspUnknown),
|
"isp_unknown", len(idsIspUnknown),
|
||||||
"isp_china_telecom", len(idsIspTelecom),
|
"isp_telecom", len(idsIspTelecom),
|
||||||
"isp_china_unicom", len(idsIspUnicom),
|
"isp_unicom", len(idsIspUnicom),
|
||||||
"isp_china_mobile", len(idsIspMobile),
|
"isp_mobile", len(idsIspMobile),
|
||||||
"other_edges", len(otherEdges),
|
"other_edges", len(otherEdges),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -319,6 +319,9 @@ func ProxyReportUpdate(c *fiber.Ctx) (err error) {
|
|||||||
do := q.Edge.Debug().Where(q.Edge.ID.Eq(edge.Id))
|
do := q.Edge.Debug().Where(q.Edge.ID.Eq(edge.Id))
|
||||||
|
|
||||||
var assigns = make([]field.AssignExpr, 0, 5)
|
var assigns = make([]field.AssignExpr, 0, 5)
|
||||||
|
if edge.Host != nil {
|
||||||
|
assigns = append(assigns, q.Edge.Host.Value(*edge.Host))
|
||||||
|
}
|
||||||
if edge.Port != nil {
|
if edge.Port != nil {
|
||||||
assigns = append(assigns, q.Edge.ProxyPort.Value(*edge.Port))
|
assigns = append(assigns, q.Edge.ProxyPort.Value(*edge.Port))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user