优化节点连接管理逻辑与日志输出,修改连接错误处理函数的返回值以确保错误处理灵活性

This commit is contained in:
2025-05-29 14:44:06 +08:00
parent 1831c792ad
commit ceb381bc9b
9 changed files with 57 additions and 48 deletions

View File

@@ -210,14 +210,15 @@ func startTask(ctx context.Context) error {
if len(updates) == 0 {
continue
}
err := app.Update(updates)
lock.Lock()
clear(updates)
updates = updates[:0]
lock.Unlock()
err := app.Update(updates)
if err != nil {
slog.Error("调度更新任务失败", "err", err)
} else {
clear(updates)
updates = updates[:0]
}
lock.Unlock()
}
}
}